Fork me on GitHub

I’m not interested in async everything and the parts that need it are already async, so that sounds good to me


Hello, I have encountered weird problem during testing, all responses from Peridot (HTTP mock lib based on ring-mock) are returned as I have pretty much standard set up - with my app looking like this

(defapi app {:format [:json-kw :transit-json]
                     :swagger swagger-config} ; copypasta from tutorial
   (middleware [mk-defaults]) ; XSS protection I am using in other projects
And the mocking part of the test is
(-> (session app)
       (request "/fingerprint/api/register"
                :request-method :post
                :content-type "application/json"
                :headers {"Accept" "application/json"} ; error is the same even without this header
                :body body)
Strange thing here is that both request and response parts handle the body as InputStream and not as JSON.


The very same thing works for me on other projects based just on Compojure/Luminus so I am not sure where could be a problem (and I am slowly getting desperate here)


btw it returns correct body when I call it from Swagger doc page (and generated curl command works as well)


@petr.mensik response body can be a stream, use (slurp body) to convert it into a string see Ring spec:


@metametadata got it but why is the result different when using plain curl?


@petr.mensik the response should be the same, just packaged into a stream by ring-middleware-format. Ring-adapter can write both streams of string into the response stream and they look the same when viewed over http.


so, slurp should give the json to you.


anyway, slurp works so thanks a lot 🙂