mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
This commit is contained in:
parent
21af3a9213
commit
eb47553eea
11
src/ajax.js
11
src/ajax.js
@ -624,12 +624,17 @@ jQuery.extend({
|
||||
}
|
||||
}
|
||||
|
||||
// If not modified
|
||||
if ( status === 304 ) {
|
||||
// if no content
|
||||
if ( status === 204 ) {
|
||||
isSuccess = true;
|
||||
statusText = "nocontent";
|
||||
|
||||
// if not modified
|
||||
} else if ( status === 304 ) {
|
||||
isSuccess = true;
|
||||
statusText = "notmodified";
|
||||
|
||||
// If we have data
|
||||
// If we have data, let's convert it
|
||||
} else {
|
||||
isSuccess = ajaxConvert( s, response );
|
||||
statusText = isSuccess.state;
|
||||
|
5
test/data/nocontent.php
Normal file
5
test/data/nocontent.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
header('HTTP/1.0 204 No Content');
|
||||
|
||||
?>
|
@ -1499,6 +1499,26 @@ module( "ajax", {
|
||||
}
|
||||
});
|
||||
|
||||
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()
|
||||
|
||||
ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, {
|
||||
|
Loading…
Reference in New Issue
Block a user