Fork me on GitHub
#liberator
<
2015-12-20
>
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?

jeremys16:12:38

@joe.lane: 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.

jeremys16:12:19

It doesn't play nice if you want to use https://github.com/ring-clojure/ring-json 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.

jeremys18:12:28

@joe.lane: I completely overlooked this page of the doc thanks!!! I had read https://clojure-liberator.github.io/liberator/tutorial/conneg.html 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.