Bug Tracker

Opened 12 years ago

Closed 12 years ago

#8106 closed bug (wontfix)

ajaxSetup instantiated contentType not included when no data is sent

Reported by: [email protected] Owned by: jaubourg
Priority: blocker Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:


Perhaps this was done purposely, but this is a change to the method.


Change History (4)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledajax
Owner: set to jaubourg
Priority: undecidedblocker
Status: newassigned

comment:2 Changed 12 years ago by jitter

I think this is only a little wording problem in the documentation. The jQuery.ajax() documentation says:

contentType: [...] If you explicitly pass in a content-type to $.ajax() then it'll always be sent to the server (even if no data is sent).

These two test cases show that the documentation has to be taken literal.

test case works as expected because contentType is passed directly to jQuery.ajax(...)

This test case doesn't send the content-type header when there is no data as the contentType setting wasn't passed "directly" to jQuery.ajax(...)

So the documentation needs to be taken literal. Only if you pass the contentType option directly to $.ajax(...) it gets send even when there is no data.

comment:3 Changed 12 years ago by [email protected]

This is the specific case where I'm having an issue. Maybe this is just an issue with $.post():


jQuery 1.4.3-1.4.4 will apply the contentType, other versions do not (so maybe this was never meant to happen?)

comment:4 Changed 12 years ago by danheberden

Resolution: wontfix
Status: assignedclosed

Correct - this behaviour was actually a bug in 1.4.2/3. The method to force content-type as jitter explains is the only way.

Note: See TracTickets for help on using tickets.