Ticket #8106 (closed bug: wontfix)
ajaxSetup instantiated contentType not included when no data is sent
| Reported by: | briana@… | Owned by: | jaubourg |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.next |
| Component: | ajax | Version: | 1.5 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Perhaps this was done purposely, but this is a change to the method.
Change History
comment:1 Changed 2 years ago by rwaldron
- Owner set to jaubourg
- Priority changed from undecided to blocker
- Status changed from new to assigned
- Component changed from unfiled to ajax
comment:2 Changed 2 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
