X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=35c030247e1baf5c19da21997ac30af9b5a01563;hb=974637d639a06a050e11d87677d1c1c80bed709d;hp=b11342f3f61a1df616dab412b3a726256f69d39f;hpb=0b0889ceaaafb1fe37a87b14476066b8f9e93ce9;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index b11342f..35c0302 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -280,8 +280,7 @@ test("jQuery.ajax() - error callbacks", function() { test(".ajax() - headers" , function() { - // No multiple line headers in IE - expect( jQuery.browser.msie ? 3 : 5 ); + expect( 2 ); stop(); @@ -291,18 +290,15 @@ test(".ajax() - headers" , function() { 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" ); @@ -310,23 +306,8 @@ test(".ajax() - headers" , function() { 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"); } });