Opened 7 years ago

Closed 5 years ago

Last modified 5 years ago

#14993 closed defect (fixed)

Content-Type is repeated when using dojo.xhr

Reported by: Randy Hudson Owned by: Bryan Forbes
Priority: undecided Milestone: 1.8
Component: IO Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Here's a snippet showing the bug:

var args = {

url: '/foo', headers: {'content-type': 'text/plain'}

}; dojo.xhrGet(args); args.url = '/bar'; dojo.xhrGet(args);

In the second call to xhrGet, the outgoing request has header:

content-type:text/plain, text/plain

The first call to xhrGet is corrupting the args, causing the second call to have the problem.

Change History (3)

comment:1 Changed 7 years ago by Randy Hudson

Here's the problematic code in xhr.js:

if(hdr.toLowerCase() === "content-type" && !args.contentType){

args.contentType = args.headers[hdr];

A variable should be used instead of modifying the caller's args.

comment:2 Changed 5 years ago by Bryan Forbes

Resolution: fixed
Status: newclosed

This was fixed when dojo/request was written.

comment:3 Changed 5 years ago by bill

Milestone: tbd1.8
Note: See TracTickets for help on using tickets.