On 19 December 2010 02:58, Miki <[email protected]> wrote:
>> What's the content-type of the POST? If it's
>> "application/x-www-form-urlencoded", then the body stream will be
>> automatically parsed into a map of parameters, thus consuming the
>> stream.
>
> The content-type is application/www-form-urlencoded but the body is not a
> form, just a JSON object.
> Is there way to tell Comojure not to do this magic?

The easiest way around it is to write some middleware to correct the
content-type:

(defn wrap-correct-content-type [handler]
  (fn [request]
    (handler (assoc request :content-type "application/json"))))

This middleware would have to wrap the routes you expect to receive
incorrectly typed requests.

But, if you can, it would make more sense to fix this at the client.
Anything else is just a hack.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to