Fork me on GitHub
#reitit
<
2019-12-27
>
dharrigan21:12:58

Having an issue trying to write out this {:foo [json1 json2 json3 jsonN]} where json1 is a string of JSON data (a document), so :foo is a key in a map containing a vector of documents. I'm getting this stack java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #'ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentArrayMap

dharrigan21:12:31

In my router configuration, I have this

dharrigan21:12:34

{:data {:coercion rcs/coercion
             :muuntaja m/instance
             :middleware [muuntaja/format-middleware
                          parameters/parameters-middleware
                          coercion/coerce-exceptions-middleware
                          coercion/coerce-request-middleware
                          coercion/coerce-response-middleware]}})))

dharrigan21:12:48

so I would have thought that the vector would be written out (as a JSON array)...

dharrigan22:12:26

Hmm, it seems that if I wrap the body in cheshire.core/generate-string {:foo [jsonN...]} it works - although, I think it's still not quite right.