import "../ajax.js";
-jQuery.ajaxPrefilter( function( s ) {
+jQuery.ajaxPrefilter( function( s, origOptions ) {
// Binary data needs to be passed to XHR as-is without stringification.
- if ( typeof s.data !== "string" && !jQuery.isPlainObject( s.data ) ) {
+ if ( typeof s.data !== "string" && !jQuery.isPlainObject( s.data ) &&
+
+ // Don't disable data processing if explicitly set by the user.
+ !( "processData" in origOptions ) ) {
s.processData = false;
}
};
} );
+ ajaxTest( "jQuery.ajax() - non-plain object", 1, function( assert ) {
+ return {
+ url: url( "mock.php?action=name" ),
+ method: "post",
+ data: Object.create( { name: "peter" } ),
+ success: function( data ) {
+ assert.strictEqual( data, "ERROR", "Data correctly not sent" );
+ }
+ };
+ } );
+
+ ajaxTest( "jQuery.ajax() - non-plain object with processData: true", 1, function( assert ) {
+ return {
+ url: url( "mock.php?action=name" ),
+ method: "post",
+ processData: true,
+ data: Object.create( { name: "peter" } ),
+ success: function( data ) {
+ assert.strictEqual( data, "pan", "Data sent correctly" );
+ }
+ };
+ } );
+
} )();