aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2015-10-22 14:25:32 -0400
committerDave Methvin <dave.methvin@gmail.com>2015-11-02 13:14:46 -0500
commit70605c8e5655da996ebd395e3c43423daaa08d9c (patch)
tree927ac4bad205e9f6689c00440a738cd321f25fea /test/unit/ajax.js
parent015d16c02dae770eda88e644ec69ce82f25c0412 (diff)
downloadjquery-70605c8e5655da996ebd395e3c43423daaa08d9c.tar.gz
jquery-70605c8e5655da996ebd395e3c43423daaa08d9c.zip
Ajax: Only form-encode requests with a body
Fixes #2658 Closes #2671
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index ba11c90ee..7710f9e35 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1129,6 +1129,48 @@ QUnit.module( "ajax", {
};
} );
+ ajaxTest( "jQuery.ajax() - data - x-www-form-urlencoded (gh-2658)", 1, function( assert ) {
+ return {
+ url: "bogus.html",
+ data: { devo: "A Beautiful World" },
+ type: "post",
+ beforeSend: function( _, s ) {
+ assert.strictEqual( s.data, "devo=A+Beautiful+World", "data is '+'-encoded" );
+ return false;
+ },
+ error: true
+ };
+ } );
+
+ ajaxTest( "jQuery.ajax() - data - text/plain (gh-2658)", 1, function( assert ) {
+ return {
+ url: "bogus.html",
+ data: { devo: "A Beautiful World" },
+ type: "post",
+ contentType: "text/plain",
+ beforeSend: function( _, s ) {
+ assert.strictEqual( s.data, "devo=A%20Beautiful%20World", "data is %20-encoded" );
+ return false;
+ },
+ error: true
+ };
+ } );
+
+ ajaxTest( "jQuery.ajax() - data - no processing ", 1, function( assert ) {
+ return {
+ url: "bogus.html",
+ data: { devo: "A Beautiful World" },
+ type: "post",
+ contentType: "x-special-sauce",
+ 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(