(Re) Fixes #8884 in a way that keeps the format of the headers map sent to transports natural.
This commit is contained in:
parent
8d3754751d
commit
3a3842c669
|
@ -95,7 +95,7 @@ function addToPrefiltersOrTransports( structure ) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//Base inspection function for prefilters and transports
|
// Base inspection function for prefilters and transports
|
||||||
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
|
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
|
||||||
dataType /* internal */, inspected /* internal */ ) {
|
dataType /* internal */, inspected /* internal */ ) {
|
||||||
|
|
||||||
|
@ -389,6 +389,7 @@ jQuery.extend({
|
||||||
ifModifiedKey,
|
ifModifiedKey,
|
||||||
// Headers (they are sent all at once)
|
// Headers (they are sent all at once)
|
||||||
requestHeaders = {},
|
requestHeaders = {},
|
||||||
|
requestHeadersNames = {},
|
||||||
// Response headers
|
// Response headers
|
||||||
responseHeadersString,
|
responseHeadersString,
|
||||||
responseHeaders,
|
responseHeaders,
|
||||||
|
@ -412,7 +413,9 @@ jQuery.extend({
|
||||||
// Caches the header
|
// Caches the header
|
||||||
setRequestHeader: function( name, value ) {
|
setRequestHeader: function( name, value ) {
|
||||||
if ( !state ) {
|
if ( !state ) {
|
||||||
requestHeaders[ name.toLowerCase() ] = { n: name, v: value };
|
var lname = name.toLowerCase();
|
||||||
|
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
|
||||||
|
requestHeaders[ name ] = value;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
|
@ -104,7 +104,7 @@ if ( jQuery.support.ajax ) {
|
||||||
// Need an extra try/catch for cross domain requests in Firefox 3
|
// Need an extra try/catch for cross domain requests in Firefox 3
|
||||||
try {
|
try {
|
||||||
for ( i in headers ) {
|
for ( i in headers ) {
|
||||||
xhr.setRequestHeader( headers[ i ].n, headers[ i ].v );
|
xhr.setRequestHeader( i, headers[ i ] );
|
||||||
}
|
}
|
||||||
} catch( _ ) {}
|
} catch( _ ) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue