clojure-liberator / liberator

Liberator is a Clojure library for building RESTful applications.
http://clojure-liberator.github.io/liberator
Other
1.26k stars 133 forks source link

Support parsing request body depending on content-type #39

Open ordnungswidrig opened 11 years ago

ordnungswidrig commented 11 years ago

The counterpart to representation generation is the parsing of the entity in the request body for POST, PUT, PATCH. We need a extensible mechanism like for the representation to enable parsing of the body input stream into a data structure.

plucury commented 11 years ago

For now, I use ring.middleware.params/wrap-params and ring.middleware.json-params/wrap-json-params to do this kind of work. And they are very easy to use. So if we want to do this in liberator, Which content-type should be supported first?

ordnungswidrig commented 11 years ago

We need to differentiate between query parameters and the body. The body can encode parameters as application/url-form-encoded but also transport any other media type.

I think the a body-parsing step should convert the body input stream into a body representation. Maybe a ring middle ware is the right thing to do which exposes the parsed data in the request at :parsed-body or like that.