Skip to content
Permalink
Browse files

Removes unnecessary test and ensures getResponseHeader returns null i…

…f the header does not exist.
  • Loading branch information
jaubourg committed Jan 19, 2011
1 parent bd6eb84 commit d343bfe528cbb8b08c3beb94cb33d1c444932f06
Showing with 7 additions and 12 deletions.
  1. +7 −12 src/ajax.js
@@ -295,30 +295,25 @@ jQuery.extend({
},

// Builds headers hashtable if needed
// (match is used internally)
getResponseHeader: function( key , match ) {
getResponseHeader: function( key ) {

var match;

if ( state === 2 ) {

if ( responseHeaders === undefined ) {
if ( !responseHeaders ) {

responseHeaders = {};

if ( typeof responseHeadersString === "string" ) {

while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
}
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];

} else {

match = null;
}

return match;
return match || null;
},

// Cancel the request

0 comments on commit d343bfe

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