New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how would you guys implement auto body conversion? #29
Comments
Liberator has the concept of representations. In Fortunately there are already implementations for strings, sequences, maps, etc. for the media types text/plain, csv, tsv, application/clojure and application/json in A simple resource definition would look like this:
In the examples there a more resources, e.g. here: https://github.com/clojure-liberator/liberator/blob/master/examples/clj/examples.clj#L123 |
i already know about this, as i have changed the clojure.data.json function to use the latest version of cheshire on the version of liberator that i have pulled down and have been playing with. i want to know about dealing with the request. |
I'm not sure if I understand what you want? Do you man to automatically parse the request body? |
yes |
The most natural implementation IMHO is to use the valid-content-header? decision point: (defresource foo Of course there is room for some to-be-written helper functionsm e.g.: (parse-body "application/json" chesire/parse-stream "application/clojure" safe-parse-with-clojure-reader) I'd be happy if you would contribute something like this. |
that looks good. |
something like
(wrap-json-body)
The text was updated successfully, but these errors were encountered: