Opened 9 years ago

Closed 8 years ago

#11044 closed defect (invalid)

dojo.xhr() headers modification

Reported by: Fausto Lemos Owned by: anonymous
Priority: high Milestone: tbd
Component: Core Version: 1.5.0b1
Keywords: Cc:
Blocked By: Blocking:



using dojo.xhr(), i tried to change the charset of the request as follow:

headers: {
                "Content-Type": "application/x-www-form-urlencoded",
                "Content-Encoding": "ISO-8859-1"

I also tried:

headers: {
                "Content-Type": "application/x-www-form-urlencoded;charset=iso-8859-1"

But when i inspect the headers that was sent with the request i get always:

Content-Type application/x-www-form-urlencoded; charset=UTF-8

Interesting note is: if i set charset with "utf-8" my Content-Type result is:

application/x-www-form-urlencoded; charset=utf-8

If i put anything different than that, then he automatically puts UTF-8, ignoring my ISO-8859-1. Those "UTF-8" in upper case was my clue that dojo don't let me change charset, he only allows me to inform the same thing he will put if i don't set anything. The "Content-Encoding" parameter of my first test doesn't change anything. I configure my application to always use "iso-8859-1" in every request, so if dojo don´t let me change the default charset of the request, i´m in trouble.


Change History (4)

comment:1 Changed 9 years ago by Fausto Lemos

correction: version 1.4

comment:2 Changed 9 years ago by James Burke

Resolution: invalid
Status: newclosed

Do you have a contentType setting in the object passed to the dojo.xhr call? If so, that one takes priority over the headers value. If you can detail a full dojo.xhr call I can try to reproduce. Closing the bug for now, since inspection of the dojo/_base/xhr.js code implies that user specified values should work.

Going to close this for now, but please reopen with a full dojo.xhr() call example and what browser(s) show the problem.

comment:3 Changed 9 years ago by Fausto Lemos

Resolution: invalid
Status: closedreopened

Hello jburke!

i take a look at the documentation and doesn´t see the "contentType" attribute. In older versions of Dojo i saw this parameter but since 1.4 don´t. For this reason i´m setting the "headers" attribute and then i found the problem. Do you heave a link for some example or documentation that show this "contentType" been used?


comment:4 Changed 8 years ago by Adam Peller

Resolution: invalid
Status: reopenedclosed

try looking at the headers property, or example #8 here (broken at the moment) If you have other questions, you can try posting to the dojo-interest list.

Note: See TracTickets for help on using tickets.