Fork me on GitHub
Joe Lane14:12:35

can you define "not to try to convert data to json by itself?"

Joe Lane14:12:57

do you mean when it comes out of liberator via the resource or as input?


@lanejo01: Hi thanks for your interest! what I mean is that when a ressouce declares "application/json" as the :available-media-type and the :handle-ok function returns clojure data, liberator will try to generate a json string from that data.


It doesn't play nice if you want to use wrap-json-response.

Joe Lane17:12:40

what would you prefer it return? I ran into this last week with csv data and the docs do not make it very clear how to return csv data.

Joe Lane17:12:57

these are the docs for custom json response. in this example {:some "json"} is the response data and beneath that are the headers. ring-response ( if I remember correctly) is from liberator.


@lanejo01: I completely overlooked this page of the doc thanks!!! I had read and thought, since content negociation whas to be handled in the :handle-ok fn, liberator didn't care about what the :handle-ok fn returned and just stuck it in the body of a response map. I'll admit I hadn't thought deeply (if at all) at what needs to happen to the body of the response or where does it need to happen.