Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#15552 closed defect (duplicate)

dojo.xhrPost/ is setting incorrect Content-Type header (1.8.0b1)

Reported by: talisto Owned by:
Priority: undecided Milestone: tbd
Component: Core Version:
Keywords: Cc:
Blocked By: Blocking:


In dojo 1.7.x, dojo.xhrPost defaults the Content-Type header to 'application/x-www-form-urlencoded'. However, this doesn't appear to be the case in 1.8.0b1; when testing in Chrome, the Content-Type is set to 'application/xml', and in Firefox, the Content-Type is set to 'text/plain' (I'm assuming these are browser defaults?). Because of this, the POST data isn't actually sent correctly or interpreted properly on the server side.

I've attached a test-case (PHP script). When run, it sends an xhrPost request to itself with some test data, and it then responds to the xhrPost request with a json-encoded array of the POST and GET data, which is then output to the page. When run in 1.7.3, the data is returned correctly as expected. However, in 1.8.0b1, nothing is returned.

In Chrome, using Dojo 1.7.3, if I copy the request as HAR, the postData is as follows:

    "postData": {
      "mimeType": "application/x-www-form-urlencoded",
      "text": "testing1=testing!&testing2=testing%20again!",
      "params": [
          "name": "testing1",
          "value": "testing!"
          "name": "testing2",
          "value": "testing%20again!"

With Dojo 1.8.0b1, I see the following:

    "postData": {
      "mimeType": "application/xml",
      "text": "testing1=testing!&testing2=testing%20again!"
    } the params are not being interpreted. I've checked the livedocs to see if I'm missing something that has changed, but I don't see any mention of any usage changes for this function for 1.8.0.

Attachments (1)

xhrpost.php (1.1 KB) - added by talisto 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by talisto

Attachment: xhrpost.php added

comment:1 Changed 10 years ago by liucougar

Resolution: duplicate
Status: newclosed

dup of #15548 (which has a patch)

comment:2 Changed 10 years ago by talisto

whoops, sorry about the dupe!

Note: See TracTickets for help on using tickets.