Skip to content

Commit c01e022

Browse files
committed
Fix #11586. Ajax DELETE ain't got no body, so data goes to its URL.
1 parent a9c2a9b commit c01e022

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/ajax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var // Document location
77
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
88
// #7653, #8125, #8152: local protocol detection
99
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
10-
rnoContent = /^(?:GET|HEAD)$/,
10+
rnoContent = /^(?:GET|HEAD|DELETE)$/,
1111
rprotocol = /^\/\//,
1212
rquery = /\?/,
1313
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,

test/unit/ajax.js

+15
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,21 @@ test("jQuery.ajax - HEAD requests", function() {
840840

841841
});
842842

843+
844+
test("jQuery.ajax - DELETE requests", function() {
845+
expect(1);
846+
847+
jQuery.ajax({
848+
url: "devo.html",
849+
type: "DELETE",
850+
data: { "whip": "it", "qty": "good" },
851+
beforeSend: function( _ , s ) {
852+
equal( s.url, "devo.html?whip=it&qty=good", "Delete requests encode data in URL" );
853+
return false;
854+
}
855+
});
856+
});
857+
843858
test("jQuery.ajax - beforeSend", function() {
844859
expect(1);
845860
stop();

0 commit comments

Comments
 (0)