#16532 closed defect (fixed)
[patch][cla] dojo/request/xhr default overrides specified content-type header
Reported by: | Brandon Payton | Owned by: | Bryan Forbes |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8.4 |
Component: | IO | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The default Content-Type in dojo/request/xhr overrides a specified content-type header when the letter casing isn't exactly "Content-Type".
The following sends the default Content-Type 'application/x-www-form-urlencoded' instead of 'application/json':
xhr.post("http://some/url", { headers: { "content-type": "application/json" }, data: "[]" })
I have attached patches for a fix and an additional unit test. The unit test required an additional PHP file for dojo/tests/request/, and that is attached as well.
Any feedback is appreciated.
Attachments (3)
Change History (11)
Changed 8 years ago by
Attachment: | dojo-request-xhr.patch added |
---|
Changed 8 years ago by
Attachment: | dojo-tests-request-xhr.patch added |
---|
The patch for dojo/tests/request/xhr.html
Changed 8 years ago by
Attachment: | xhrEchoContentTypeHeader.php added |
---|
An additional supporting .php file to be placed in dojo/tests/request/
comment:2 Changed 8 years ago by
I just realized this patch doesn't add the default Content-Type into response.options.headers
. That seems desirable. Let me know what you think, and I can provide another patch and test case to verify the default content-type shows up in response.options.
comment:3 Changed 8 years ago by
Component: | General → IO |
---|---|
Owner: | set to Bryan Forbes |
comment:4 Changed 8 years ago by
Milestone: | tbd → 1.9 |
---|
Bryan,
Please review for consideration as part of 1.9.
comment:7 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 Changed 8 years ago by
Milestone: | 1.9 → 1.8.4 |
---|
The patch for dojo/request/xhr.js