]> source.dussan.org Git - jquery.git/commitdiff
Continuing to map request headers using their name in uppercase for the index, but...
authorSam Bisbee <sam@sbisbee.com>
Fri, 15 Apr 2011 20:36:43 +0000 (16:36 -0400)
committerSam Bisbee <sam@sbisbee.com>
Fri, 15 Apr 2011 20:36:43 +0000 (16:36 -0400)
src/ajax.js
src/ajax/xhr.js

index f0d7228455900c19eb104f091a16905d174657b6..05b0a1605b3cc4bc236b7c3f7abf92236a7d5275 100644 (file)
@@ -416,7 +416,7 @@ jQuery.extend({
                                // Caches the header
                                setRequestHeader: function( name, value ) {
                                        if ( !state ) {
-                                               requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value;
+                                               requestHeaders[ name.toUpperCase().replace( rucHeaders, rucHeadersFunc ) ] = { name: name, value: value};
                                        }
                                        return this;
                                },
@@ -664,24 +664,27 @@ jQuery.extend({
 
                // Set the correct header, if data is being sent
                if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
-                       requestHeaders[ "Content-Type" ] = s.contentType;
+                       jqXHR.setRequestHeader( "Content-Type", s.contentType );
                }
 
                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
                if ( s.ifModified ) {
                        ifModifiedKey = ifModifiedKey || s.url;
                        if ( jQuery.lastModified[ ifModifiedKey ] ) {
-                               requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ];
+                               jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
                        }
                        if ( jQuery.etag[ ifModifiedKey ] ) {
-                               requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ];
+                               jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
                        }
                }
 
                // Set the Accepts header for the server, depending on the dataType
-               requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
-                       s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
-                       s.accepts[ "*" ];
+                jqXHR.setRequestHeader(
+                                       "Accept",
+                                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+                                               s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
+                                               s.accepts[ "*" ]
+                                       );
 
                // Check for headers option
                for ( i in s.headers ) {
index 5dbc33d3fd7e7751a1ea15628993f2f2ac1c63d8..0c837c5aa4ea5851aeeb36c05050b9387c460024 100644 (file)
@@ -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( i, headers[ i ] );
+                                                       xhr.setRequestHeader( headers[ i ].name, headers[ i ].value );
                                                }
                                        } catch( _ ) {}