aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJulian Aubourg <j@ubourg.net>2013-05-23 02:11:37 +0200
committerJulian Aubourg <j@ubourg.net>2013-05-23 02:39:20 +0200
commit53095883ef423260270de50b387eb5b17963d333 (patch)
treeefd3cf21c8765e4348548c2c08515164ffbabe43 /test
parentef31479446ac3ae9bbd11adf34edd18850f347f0 (diff)
downloadjquery-53095883ef423260270de50b387eb5b17963d333.tar.gz
jquery-53095883ef423260270de50b387eb5b17963d333.zip
Handles HEAD requests as if they always were 204. Fixes #13922.
Diffstat (limited to 'test')
-rw-r--r--test/unit/ajax.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 74307cb79..21ecdd2f7 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1542,6 +1542,29 @@ module( "ajax", {
}
});
+ ajaxTest( "#13922 - jQuery.ajax() - converter is bypassed for HEAD requests", 3, {
+ url: "data/json.php",
+ method: "HEAD",
+ data: {
+ header: "yes"
+ },
+ converters: {
+ "text json": function() {
+ throw "converter was called";
+ }
+ },
+ success: function( data, status ) {
+ ok( true, "success" );
+ strictEqual( status, "nocontent", "data is undefined" );
+ strictEqual( data, undefined, "data is undefined" );
+ },
+ error: function( _, status, error ) {
+ ok( false, "error" );
+ strictEqual( status, "parsererror", "Parser Error" );
+ strictEqual( error, "converter was called", "Converter was called" );
+ }
+ } );
+
//----------- jQuery.ajaxPrefilter()
ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, {