diff options
author | jaubourg <j@ubourg.net> | 2011-02-09 17:47:33 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-02-09 17:47:33 +0100 |
commit | f6e173437e9f94cd4e713e556c6fc8ca68be8384 (patch) | |
tree | 8abefe24d3d21fd6e15d90a89456cadf2967ff3c /test/unit/ajax.js | |
parent | 806d9ce8111128c4f30c6559c325f8a4ad1018a3 (diff) | |
download | jquery-f6e173437e9f94cd4e713e556c6fc8ca68be8384.tar.gz jquery-f6e173437e9f94cd4e713e556c6fc8ca68be8384.zip |
Fixes #8219. Introduces the mimeType option to override content-type header in conversion (and in native xhr when possible). Adds companion overrideMimeType method on jqXHR object (it simply sets the option). Unit test added.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r-- | test/unit/ajax.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 59159c320..74c6545c5 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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 ); |