Renamed $.ajax's "before"-option to "beforeSend" to prevent conflict with form plugin...
[jquery.git] / src / ajax / ajaxTest.js
index 98f7cfc..cbc15ad 100644 (file)
@@ -277,4 +277,21 @@ test("$.ajax - xml: non-namespace elements inside namespaced elements", function
            start();
          }
        });
+});
+
+test("$.ajax - preprocess", function() {
+       expect(1);
+       stop();
+       var customHeader = "value";
+       $.ajax({
+               url: "data/name.php", 
+               data: {'req': true},
+               beforeSend: function(xml) {
+                       xml.setRequestHeader('X-Custom-Header', customHeader);
+               },
+               success: function(data) {
+                       ok( data == customHeader, "check return value, should be the custom header sent" );
+                       start();
+               }
+       });
 });
\ No newline at end of file