aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-02-07 16:35:32 +0100
committerjaubourg <j@ubourg.net>2011-02-07 16:35:32 +0100
commita2dbdc1f5438a857c2a9898bd36e4b2de685742e (patch)
treec90de9e616fd53ee38987955893df510b1d587d2 /test/unit/ajax.js
parent0c21c83e9691a08151f23a2c594568b07009f063 (diff)
downloadjquery-a2dbdc1f5438a857c2a9898bd36e4b2de685742e.tar.gz
jquery-a2dbdc1f5438a857c2a9898bd36e4b2de685742e.zip
Fixes a bug that prevented headers from being set in an ajaxSend callback. Unit test modified.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index cf7c0ad0b..59159c320 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -348,10 +348,14 @@ test(".ajax() - headers" , function() {
stop();
+ jQuery('#foo').ajaxSend(function( evt, xhr ) {
+ xhr.setRequestHeader( "ajax-send", "test" );
+ });
+
var requestHeaders = {
- siMPle: "value",
- "SometHing-elsE": "other value",
- OthEr: "something else"
+ siMPle: "value",
+ "SometHing-elsE": "other value",
+ OthEr: "something else"
},
list = [],
i;
@@ -359,22 +363,25 @@ test(".ajax() - headers" , function() {
for( i in requestHeaders ) {
list.push( i );
}
+ list.push( "ajax-send" );
jQuery.ajax(url("data/headers.php?keys="+list.join( "_" ) ), {
+
headers: requestHeaders,
success: function( data , _ , xhr ) {
var tmp = [];
for ( i in requestHeaders ) {
tmp.push( i , ": " , requestHeaders[ i ] , "\n" );
}
+ 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" );
- start();
},
error: function(){ ok(false, "error"); }
- });
+
+ }).then( start, start );
});