Converting BufferedInputStream to String in Clojure

mock.request returns a response: body as a BufferedInputStream. I need to print and compare this as a string. How to convert it?

When I try to convey the response as a message to my statement, I see the original output, for example

(is (= 200 (:status response) (:body response)))
=> #object[java.io.BufferedInputStream 0x211bdf40 java.io.BufferedInputStream@211bdf40]

Related questions are specific to Java.

+4
source share
2 answers

Just slurpit:

(slurp (:body response))
+4
source

I usually use https://github.com/ztellman/byte-streams :

(convert (:body res) String)
0
source

All Articles