Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax: Don't process data property on no-entity-body requests #3781

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ajax.js
Expand Up @@ -596,8 +596,8 @@ jQuery.extend( {
// Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length );

// If data is available, append data to url
if ( s.data ) {
// If data is available and should be processed, append data to url
if ( s.data && s.processData ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;

// #9682: remove data so that it's not used in an eventual retry
Expand Down
17 changes: 16 additions & 1 deletion test/unit/ajax.js
Expand Up @@ -1273,7 +1273,7 @@ QUnit.module( "ajax", {
};
} );

ajaxTest( "jQuery.ajax() - data - no processing ", 1, function( assert ) {
ajaxTest( "jQuery.ajax() - data - no processing POST", 1, function( assert ) {
return {
url: "bogus.html",
data: { devo: "A Beautiful World" },
Expand All @@ -1288,6 +1288,21 @@ QUnit.module( "ajax", {
};
} );

ajaxTest( "jQuery.ajax() - data - no processing GET", 1, function( assert ) {
return {
url: "bogus.html",
data: { devo: "A Beautiful World" },
type: "get",
contentType: "x-something-else",
processData: false,
beforeSend: function( _, s ) {
assert.deepEqual( s.data, { devo: "A Beautiful World" }, "data is not processed" );
return false;
},
error: true
};
} );

var ifModifiedNow = new Date();

jQuery.each(
Expand Down