diff options
author | byroot <jean.boussier@gmail.com> | 2013-01-24 02:33:17 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2013-01-24 02:34:02 +0100 |
commit | bfc61b879e9e94ef7c6b31919b7f287ffdf180a8 (patch) | |
tree | e0d07ac733a04392e3cc3c70880f5c08a78ffac5 /test | |
parent | caac041fcc31724b8b579939e8053966559483ca (diff) | |
download | jquery-bfc61b879e9e94ef7c6b31919b7f287ffdf180a8.tar.gz jquery-bfc61b879e9e94ef7c6b31919b7f287ffdf180a8.zip |
Don't try and convert data for 204 No Content responses. Fixes #13292. Fixes #13261.
Diffstat (limited to 'test')
-rw-r--r-- | test/data/nocontent.php | 5 | ||||
-rw-r--r-- | test/unit/ajax.js | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/data/nocontent.php b/test/data/nocontent.php new file mode 100644 index 000000000..9c8431bd7 --- /dev/null +++ b/test/data/nocontent.php @@ -0,0 +1,5 @@ +<?php + +header('HTTP/1.0 204 No Content'); + +?>
\ No newline at end of file diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 7bc48c997..e5e82f977 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1456,6 +1456,26 @@ module( "ajax", { strictEqual( ajaxXML.find("tab").length, 3, "Parsed node was added properly" ); } }); + + ajaxTest( "#13292 - jQuery.ajax() - converter is bypassed for 204 requests", 3, { + url: "data/nocontent.php", + dataType: "testing", + converters: { + "* testing": function() { + throw "converter was called"; + } + }, + success: function( data, status, jqXHR ) { + strictEqual( jqXHR.status, 204, "status code is 204" ); + strictEqual( status, "nocontent", "status text is 'nocontent'" ); + 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() |