Fork me on GitHub
Daniel Wellman19:04:47

I’m experimenting with vcr-clj ( and have noticed that the “cassette” text files appear to have an encoded response body, which means you can’t look at the cassettes to understand what the response says (assuming a JSON text response). Does anyone know of a way to make vcr-clj keep the response as unencoded text?


I'm not sure if there's an option for that - it will try to "Base64 encode" the response body to make it serializable. You can write some utility functions to decode that, e.g.

(defn decode-body [base64-encoded-strings]
   (-> base64-encoded-strings

  (with-open [r ( (io/reader (vcr-cassettes/cassette-file :record)))]
   (let [as-edn (edn/read {:readers  (assoc vcr-serialization/data-readers
                                            'vcr-clj/input-stream decode-body)}
         body (-> as-edn :calls (get 0) :return :body)]
     (println body)))