Allow DELETE requests to have a content body, and properly serialize data to the...
[jquery.git] / test / unit / ajax.js
index 2ded127..7344659 100644 (file)
@@ -289,6 +289,32 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", fun
        });
 });
 
+test("jQuery.ajax - HEAD requests", function() {
+       expect(2);
+
+       stop();
+       jQuery.ajax({
+               url: url("data/name.html"),
+               type: "HEAD",
+               success: function(data, status, xhr){
+                       var h = xhr.getAllResponseHeaders();
+                       ok( /Date/i.test(h), 'No Date in HEAD response' );
+                       
+                       jQuery.ajax({
+                               url: url("data/name.html"),
+                               data: { whip_it: "good" },
+                               type: "HEAD",
+                               success: function(data, status, xhr){
+                                       var h = xhr.getAllResponseHeaders();
+                                       ok( /Date/i.test(h), 'No Date in HEAD response with data' );
+                                       start();
+                               }
+                       });
+               }
+       });
+       
+});
+
 test("jQuery.ajax - beforeSend", function() {
        expect(1);
        stop();
@@ -799,6 +825,21 @@ test("jQuery.ajax() - JSONP, Local", function() {
                        plus();
                }
        });
+       
+  // Supports Ticket #5803     
+       jQuery.ajax({
+               url: "data/jsonp.php",
+               jsonpCallback: "jsonpResults",
+               success: function(data){
+                       ok( data.data, "JSON results returned without dataType:jsonp when jsonpCallback is defined" );
+                       plus();
+               },
+               error: function(data){
+                       ok( false, "Ajax error JSON (GET, custom callback name)" );
+                       plus();
+               }
+       });             
+       
 });
 
 test("JSONP - Custom JSONP Callback", function() {
@@ -1318,7 +1359,7 @@ test("jQuery.ajax - Etag support", function() {
 });
 
 test("jQuery.ajax - active counter", function() {
-    ok( jQuery.ajax.active == 0, "ajax active counter should be zero: " + jQuery.ajax.active );
+    ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
 });