digideskio / zotonic

Automatically exported from code.google.com/p/zotonic
0 stars 0 forks source link

WM-1.7.3(compat) ignores client's Content-Type on HTTP PUT requests (+patch) #130

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create resource in your existing project with that has exported functions
content_types_accepted(ReqData, Context) -> 
    [{application/x-bzip2, accept_content].

accept_content(ReqData, Context) ->
    ?DEBUG(ok),
    {"ok", ReqData, Context}.

allowed_methods(ReqData, Context) ->
    {['PUT'], ReqData, Context}.

2. Update dispatch file according to this resource
3. Do a PUT request to the resource to the resource in any way you want with 
"Content-Type: application/x-bzip2" req header.

What is the expected output? What do you see instead?
In erlang console i expect to see "ok".
But in logs I see HTTP 415 (Unsupported media type) because 
application/octet-stream != application/x-bzip2.

What version of the product are you using? On what operating system?
zotonic hg (0.6.x tip branch)

Please provide any additional information below.
Bug is in the webmachine_decision_core.erl.
accepter_helper() calls function wrq:get_req_header_lc, that always return 
'undefined' for camel-case headers. To call a wrq:get_req_header is better in 
this case. In vanill WM it is somehow fixed already.

Original issue reported on code.google.com by hellla...@gmail.com on 24 Dec 2010 at 4:32

GoogleCodeExporter commented 8 years ago
Patch attached: fixes camel-case in webmachine_decision_core:accepter_helper()

Original comment by hellla...@gmail.com on 24 Dec 2010 at 4:39

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 17d510db52.

Original comment by ma...@pobox.com on 11 Jan 2011 at 2:09

GoogleCodeExporter commented 8 years ago
Thanks.

I've merged your patch into the default and the release-0.6.x branches.

(btw, are you on the zotonic contributors list?  I'm always confused with the 
cryptic usernames here on Google...)

Original comment by ma...@pobox.com on 11 Jan 2011 at 2:11