]> source.dussan.org Git - jquery.git/commitdiff
Fix #11586. Ajax DELETE ain't got no body, so data goes to its URL.
authorDave Methvin <dave.methvin@gmail.com>
Fri, 24 Aug 2012 01:30:45 +0000 (21:30 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 24 Aug 2012 01:33:29 +0000 (21:33 -0400)
src/ajax.js
test/unit/ajax.js

index cfbfcd5272b2d92a52d683f7c753943598f8619d..04b8a2536a80dce555996bd02ba2752f54a77a29 100644 (file)
@@ -7,7 +7,7 @@ var // Document location
        rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
        // #7653, #8125, #8152: local protocol detection
        rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
-       rnoContent = /^(?:GET|HEAD)$/,
+       rnoContent = /^(?:GET|HEAD|DELETE)$/,
        rprotocol = /^\/\//,
        rquery = /\?/,
        rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
index 1345eae3a73b51f15bf312791c4659d2a870b199..2483a4bbd6ed56322e04f003d14d44234ba53aab 100644 (file)
@@ -840,6 +840,21 @@ test("jQuery.ajax - HEAD requests", function() {
 
 });
 
+
+test("jQuery.ajax - DELETE requests", function() {
+       expect(1);
+
+       jQuery.ajax({
+               url: "devo.html",
+               type: "DELETE",
+               data: { "whip": "it", "qty": "good" },
+               beforeSend: function( _ , s ) {
+                       equal( s.url, "devo.html?whip=it&qty=good", "Delete requests encode data in URL" );
+                       return false;
+               }
+       });
+});
+
 test("jQuery.ajax - beforeSend", function() {
        expect(1);
        stop();