Skip to content
Permalink
Browse files

(Re) Fixes #8884 in a way that keeps the format of the headers map se…

…nt to transports natural.
  • Loading branch information...
jaubourg committed Apr 19, 2011
1 parent 8d37547 commit 3a3842c6696f121392c89b68f2f061043405ae9f
Showing with 6 additions and 3 deletions.
  1. +5 −2 src/ajax.js
  2. +1 −1 src/ajax/xhr.js
@@ -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,
dataType /* internal */, inspected /* internal */ ) {

@@ -389,6 +389,7 @@ jQuery.extend({
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
@@ -412,7 +413,9 @@ jQuery.extend({
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
requestHeaders[ name.toLowerCase() ] = { n: name, v: value };
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
@@ -104,7 +104,7 @@ if ( jQuery.support.ajax ) {
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( headers[ i ].n, headers[ i ].v );
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}

0 comments on commit 3a3842c

Please sign in to comment.
You can’t perform that action at this time.