Unfortunately jsFiddle can't be used to respond with a 204/No Content.
Could you then provide a test case somewhere on the web? A URL on a server of yourse maybe.
You might want to have a look at the jQuery function ajaxConvert which takes the request into account when creating the converters. This might be the magic thing happening behind the scenes - I don't believe it's related to mockjax.
Everything is in "I don't believe". Have you reproduced this without mockjax? If yes, could you provide a url demonstrating the issue?
Also, the Content-Type header in the request is correct since - in my case - the request sends some JSON, it's just the fact that the response is empty.
I'm not saying it's not correct. I'm just saying it doesn't make sense in relation to the bug.
contentType simply sets a *request* header: it doesn't change anything regarding the response. That
dataType would have an impact, I would understand, but
contentType? Hence why I suspect a problem with mockjax and why I'd like to have a clean, pure ajax example.
Is is possible that jQuery expects a JSON response if JSON has been sent?
In jQuery? As per the previous paragraph: no, it is not. I dunno if there is some logic like this in mockjax.
>> Pull request: https://github.com/jquery/jquery/pull/1142
+1 That's exactly what should happen!
Except we never had a test specific to 204 at that level in the code before so the (eventual) regression is elsewhere. I'd still would like to see a test case demonstrating the issue without mockjax (even if only a unit test in a PR).