diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2015-10-22 14:25:32 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2015-11-02 13:14:46 -0500 |
commit | 70605c8e5655da996ebd395e3c43423daaa08d9c (patch) | |
tree | 927ac4bad205e9f6689c00440a738cd321f25fea /src/ajax.js | |
parent | 015d16c02dae770eda88e644ec69ce82f25c0412 (diff) | |
download | jquery-70605c8e5655da996ebd395e3c43423daaa08d9c.tar.gz jquery-70605c8e5655da996ebd395e3c43423daaa08d9c.zip |
Ajax: Only form-encode requests with a body
Fixes #2658
Closes #2671
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ajax.js b/src/ajax.js index efc413650..289eb2795 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -12,6 +12,7 @@ define( [ ], function( jQuery, document, rnotwhite, location, nonce, rquery ) { var + r20 = /%20/g, rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, @@ -601,6 +602,11 @@ jQuery.extend( { // Otherwise add one to the end cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |