Removes unnecessary test and ensures getResponseHeader returns null if the header does not exist.
This commit is contained in:
parent
bd6eb849ee
commit
d343bfe528
15
src/ajax.js
15
src/ajax.js
|
@ -295,30 +295,25 @@ jQuery.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
// Builds headers hashtable if needed
|
// Builds headers hashtable if needed
|
||||||
// (match is used internally)
|
getResponseHeader: function( key ) {
|
||||||
getResponseHeader: function( key , match ) {
|
|
||||||
|
var match;
|
||||||
|
|
||||||
if ( state === 2 ) {
|
if ( state === 2 ) {
|
||||||
|
|
||||||
if ( responseHeaders === undefined ) {
|
if ( !responseHeaders ) {
|
||||||
|
|
||||||
responseHeaders = {};
|
responseHeaders = {};
|
||||||
|
|
||||||
if ( typeof responseHeadersString === "string" ) {
|
|
||||||
|
|
||||||
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
|
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
|
||||||
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
|
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
match = responseHeaders[ key.toLowerCase() ];
|
match = responseHeaders[ key.toLowerCase() ];
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
match = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return match;
|
return match || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Cancel the request
|
// Cancel the request
|
||||||
|
|
Loading…
Reference in a new issue