diff options
author | hongymagic <d.hong@me.com> | 2013-11-11 13:28:36 +1100 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2013-11-14 20:32:56 -0500 |
commit | 27b22f4ef5f3f291204f0e0f9f414ac503f6c8a8 (patch) | |
tree | 6a53c35d54ea99c42d28b4e2381515238666abee /src/ajax | |
parent | 5f325b1bee41d9fcf4b6c59ff44674524fa70400 (diff) | |
download | jquery-27b22f4ef5f3f291204f0e0f9f414ac503f6c8a8.tar.gz jquery-27b22f4ef5f3f291204f0e0f9f414ac503f6c8a8.zip |
Fix #14503: Cast to string before setting XHR header. Close gh-1427.
Diffstat (limited to 'src/ajax')
-rw-r--r-- | src/ajax/xhr.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index fe24b6751..d747093d5 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -74,7 +74,15 @@ if ( xhrSupported ) { // Set headers for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); + // Support: IE<9 + // IE's ActiveXObject throws a 'Type Mismatch' exception when setting + // request header to a null-value. + // + // To keep consistent with other XHR implementations, cast the value + // to string and ignore `undefined`. + if ( headers[ i ] !== undefined ) { + xhr.setRequestHeader( i, headers[ i ] + "" ); + } } // Do send the request |