Fixes #8219. Introduces the mimeType option to override content-type header in conver...
[jquery.git] / test / unit / ajax.js
index 59159c3..74c6545 100644 (file)
@@ -2169,6 +2169,34 @@ test("jQuery.ajax - transitive conversions", function() {
 
 });
 
+test("jQuery.ajax - overrideMimeType", function() {
+
+       expect( 2 );
+
+       stop();
+
+       jQuery.when(
+
+               jQuery.ajax( url("data/json.php") , {
+                       beforeSend: function( xhr ) {
+                               xhr.overrideMimeType( "application/json" );
+                       },
+                       success: function( json ) {
+                               ok( json.data , "Mimetype overriden using beforeSend" );
+                       }
+               }),
+
+               jQuery.ajax( url("data/json.php") , {
+                       mimeType: "application/json",
+                       success: function( json ) {
+                               ok( json.data , "Mimetype overriden using mimeType option" );
+                       }
+               })
+
+       ).then( start , start );
+
+});
+
 test("jQuery.ajax - abort in prefilter", function() {
 
        expect( 1 );