[英]Convert BufferedInputStream to String in Clojure
mock.request is returning the response :body as a BufferedInputStream. mock.request返回响应:body作为BufferedInputStream。 I need to print and compare this as a string.
我需要打印并将其作为字符串进行比较。 How do I convert it?
我该如何转换它?
When I try to pass response as a message to my assertion, I see a raw output, eg 当我尝试将响应作为消息传递给我的断言时,我看到一个原始输出,例如
(is (= 200 (:status response) (:body response)))
=> #object[java.io.BufferedInputStream 0x211bdf40 java.io.BufferedInputStream@211bdf40]
只是slurp
它:
(slurp (:body response))
我倾向于使用https://github.com/ztellman/byte-streams :
(convert (:body res) String)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.