ngrunwald / ring-middleware-format

Ring middleware for parsing parameters and emitting responses in JSON or other formats
163 stars 49 forks source link

Format Response not matching Accept header value #1

Closed lamdor closed 13 years ago

lamdor commented 13 years ago

Hi, I was running into problems using ring-middleware-format when I was trying to use the wrap-restful-response. It turns out that when I was sending the Accept: application/clojure header it wasn't matching and was still returning me the default format which is json.

So I dug a little bit into the code and found that we're trying grabbing the "Accept" header, however ring lowercases all header names according to https://github.com/mmcgrana/ring/wiki/Concepts . This is probably because header names are really supposed to be case-insensitive.

Anyways, I made the change and everything looks good. I also made a little change to depend on ring-core as it was referred to. I tried to make the dependency a little flexible.

Thanks.

ngrunwald commented 13 years ago

Indeed, I used uppercase-first because clj-http does that and did not think to check how ring handles it... Thanks for the patch!