Fork me on GitHub
#ring-swagger
<
2019-06-25
>
mrchance17:06:40

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

mrchance18:06:58

#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)"
....}

ikitommi08:06:12

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

ikitommi08:06:11

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

mrchance08:06:07

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

ikitommi16:06:37

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

mrchance12:06:29

Oh, ok, thanks

mrchance12:06:14

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

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

mrchance12:06:50

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

mrchance12:06:34

Yeah, "Content-Type" works as expected

ikitommi13:06:31

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

mrchance18:06:22

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