Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#18810 closed defect (fixed)

Inconsistent dojo/request handling of { data: undefined } on IE11/Chrome/FF

Reported by: koivunej Owned by: Dylan Schiemann <dylan@…>
Priority: undecided Milestone: 1.8.13
Component: Core Version: 1.10.4
Keywords: Cc:
Blocked By: Blocking:

Description

We've stumbled upon some inconsistencies with the dojo/request or dojo/request/xhr with IE11 at least on POST in the following case:

xhr.post(url, { data: undefined });

We do not have this kind of code but we tend to render something as JSON string, more like: { data: JSON.stringify(something) }, but end up with undefined value in the options as data property.

IE 11.0.9600.18204CO (update versions: 11.0.28) will send a POST with body of string "undefined" to the server whereas Chrome 48.0.2564.116 will not nor will FF ESR 38.6.1. Chrome and FF send no body (see below).

Expected outcome would be not to send any body content with IE11, or treat in other words, treat the data: undefined as the default value data: null.

I'll attach a tar package with:

  • server.js -- a nodejs http server, serves echo and index.html
  • index.html -- doc for comparing different bodies sent to server

You can run the server as: node server.js and point your browser to the outputted url, kill the server with CTRL-C.

Outputs across browsers:

IE11:

data: "foobar" == string, value: [foobar]
data: null == string, value: []
data: undefined == string, value: [undefined]
data: not set == string, value: []

Chrome:

data: "foobar" == string, value: [foobar]
data: null == string, value: []
data: undefined == string, value: []
data: not set == string, value: []

FF:

data: "foobar" == string, value: [foobar]
data: null == string, value: []
data: undefined == string, value: []
data: not set == string, value: []

Attachments (1)

dojo-bug-18810.tar (10.0 KB) - added by koivunej 4 years ago.
reproducing example

Download all attachments as: .zip

Change History (10)

Changed 4 years ago by koivunej

Attachment: dojo-bug-18810.tar added

reproducing example

comment:1 Changed 4 years ago by koivunej

behaves the same across chrome and IE11 with 1.11.0-rc4 build http://download.dojotoolkit.org/release-1.11.0-rc4/dojo.js with md5 da802ad3181522ffbe1226ea2ef0f799.

1.8.10 build does not contain dojo/request so cannot verify against the released build, but we are seeing this on our inhouse 1.8.x build.

comment:2 Changed 4 years ago by koivunej

fix could be to change https://github.com/dojo/dojo/blob/master/request/xhr.js#L258 as

- xhr.send(data);
+ xhr.send(typeof(data) == 'undefined' ? null : data);

or any prettier version of the above.

can't find any reports of anyone else stumbling upon this.

comment:3 Changed 3 years ago by dylan

Milestone: tbd1.12

comment:4 Changed 3 years ago by Dylan Schiemann <dylan@…>

Owner: set to Dylan Schiemann <dylan@…>
Resolution: fixed
Status: newclosed

In 5d1833a/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:5 Changed 3 years ago by Dylan Schiemann <dylan@…>

In a43a3e1/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:6 Changed 3 years ago by Dylan Schiemann <dylan@…>

In 38ff5af/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:7 Changed 3 years ago by Dylan Schiemann <dylan@…>

In 427fd21/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:8 Changed 3 years ago by Dylan Schiemann <dylan@…>

In 3e9251b/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:9 Changed 3 years ago by dylan

Milestone: 1.121.8.13

Thanks @koivunej for the report and fix, this will land in the next releases of Dojo 1.x in a couple of weeks.

Note: See TracTickets for help on using tickets.