Commit a2cd89a7 authored by Julian Aubourg's avatar Julian Aubourg

Handles HEAD requests as if they always were 204. Fixes #13922.

parent eabb56c2
......@@ -614,7 +614,7 @@ jQuery.extend({
}
// if no content
if ( status === 204 ) {
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
......
......@@ -1499,6 +1499,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, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment