Bug Tracker

Ticket #2960 (new bug)

Opened 3 months ago

jQuery sends wrong content type to server on ajax post requests if data is {}

Reported by: barushev Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.3 Component: ajax
Version: 1.2.5 Keywords: content-type
Cc: Needs: Review

Description

Small testcase:

$.post('/index')
no Content-Type and Content-Length headers
$.post('/index', null)
no Content-Type and Content-Length headers
$.post('/index', {'test': 'test'})
Content-Type	application/x-www-form-urlencoded
Content-Length	9
$.post('/index', {})
Content-Length	0
Content-Type	application/xml
$.post('/index', function () {})
Content-Length	0
Content-Type	application/xml

It's wrong Content-type application/xml in last two exaples.

---

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080419 Ubuntu/8.04 (hardy) Firefox/2.0.0.14

Attachments

Note: See TracTickets for help on using tickets.