test(".ajax() - headers" , function() {
- // No multiple line headers in IE
- expect( jQuery.browser.msie ? 3 : 5 );
+ expect( 2 );
stop();
OthEr: "something else"
},
list = [],
- i,
- sync = 2;
+ i;
for( i in requestHeaders ) {
list.push( i );
}
- list = list.join( "_" );
-
- jQuery.ajax(url("data/headers.request.php?keys="+list), {
+ jQuery.ajax(url("data/headers.php?keys="+list.join( "_" ) ), {
headers: requestHeaders,
- success: function( data ) {
+ success: function( data , _ , xhr ) {
var tmp = [];
for ( i in requestHeaders ) {
tmp.push( i , ": " , requestHeaders[ i ] , "\n" );
tmp = tmp.join( "" );
equals( data , tmp , "Headers were sent" );
- if ( ! --sync ) start();
- }
- });
-
- jQuery.ajax({
- url: url("data/headers.php"),
- success: function( _1 , _2 , xhr ){
- ok(true, "success");
- equals( xhr.getResponseHeader( "Single-Line" ) , "Hello World" , "Single line header" );
- // No multiple line headers in IE
- if ( ! jQuery.browser.msie ) {
- // Each browser has its own unique way to deal with spaces after line breaks
- // in multiple line headers, so we use regular expressions
- ok( /^Hello\s+World$/.test( xhr.getResponseHeader( "Multiple-Line" ) ) , "Multiple line" );
- ok( /^Hello\s+Beautiful\s+World$/.test( xhr.getResponseHeader( "Multiple-Multiple-Line" ) ) , "Multiple multiple line" );
- }
- if ( ! --sync ) start();
+ equals( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" );
+ start();
},
error: function(){ ok(false, "error"); }
});
equals( jQuery("jsconf", resp).length, 1, 'jsconf in responseXML' );
equals( jQuery("thing", resp).length, 2, 'things in responseXML' );
start();
+ },
+ error: function(_1,_2,error) {
+ ok( false, error );
+ start();
}
});
});
},
success: function( text ) {
equals( typeof text , "string" , "json wasn't auto-determined" );
- var json = this.dataConverters["text => json"]( text );
+ var json = this.dataConverters["text json"]( text );
ok( json.length >= 2, "Check length");
equals( json[0].name, 'John', 'Check JSON: first, name' );
equals( json[0].age, 21, 'Check JSON: first, age' );