rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
- rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /(?:^file|^widget|\-extension):$/,
}
match = responseHeaders[ key.toLowerCase() ];
}
- return match || null;
+ return match === undefined ? null : match;
},
// Overrides response content-type header
test(".ajax() - headers" , function() {
- expect( 2 );
+ expect( 4 );
stop();
tmp.push( "ajax-send: test\n" );
tmp = tmp.join( "" );
- equals( data , tmp , "Headers were sent" );
- equals( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" );
+ strictEqual( data , tmp , "Headers were sent" );
+ strictEqual( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" );
+ if ( jQuery.browser.mozilla ) {
+ ok( true, "Firefox doesn't support empty headers" );
+ } else {
+ strictEqual( xhr.getResponseHeader( "Empty-Header" ) , "" , "Empty header received" );
+ }
+ strictEqual( xhr.getResponseHeader( "Sample-Header2" ) , "Hello World 2" , "Second sample header received" );
},
error: function(){ ok(false, "error"); }