ring-swagger

ring-swagger & compojure-api
2019-06-25T17:59:40.010400Z

Hi, how can I ask muuntaja to kindly leave my response completely untouched? Following the wiki, I configured

(def no-response-coercion
  (schema-coercion/create-coercion
    (assoc schema-coercion/default-options :response nil)))
as coercion, but it's still failing to serialize e.g. a ByteArrayInputStream provided as a response body it, so I assume I'm doing something wrong

ikitommi 2019-06-26T08:03:12.011Z

@mrchance by setting a Content-Type header for example, "already formatted, don't touch" kinda hint

ikitommi 2019-06-26T08:04:11.011200Z

there is an option in Muuntaja config to set the predicate to encode the response. Hope this helps

2019-06-26T08:23:07.011400Z

Thanks, it helps a little, but the content will be a stream containing json data, so I don't really want to set a different one. I don't really understand why the above isn't working either

ikitommi 2019-06-26T16:56:37.011600Z

you don't have to set a different one, just having aany content-type will make Muuntaja skip encode

2019-06-27T12:27:29.011800Z

Oh, ok, thanks

2019-06-27T12:30:14.012Z

I rechecked the code, we do set a content type header...

#(assoc
             (ok %)
             :headers {"content-type" "application/json"})

2019-06-27T12:31:50.012200Z

Oh, if I change the case of that, it seems to work? 😱

2019-06-27T12:33:34.012400Z

Yeah, "Content-Type" works as expected

2019-06-27T12:33:42.012600Z

Thanks!

ikitommi 2019-06-27T13:47:31.012800Z

np. Ring defines that incoming headers are lower-cased, responses are sent as-is. Hitting that often...

2019-06-27T18:04:22.013Z

ooohkay, I'm sure there's a good reason for that 😉

2019-06-25T18:01:58.010600Z

#error {
 :cause "No serializer found for class java.io.ByteArrayInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)"
....}