Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#7285 closed bug (fixed)

Ajax Data Body Regression

Reported by: Mal Owned by: dmethvin
Priority: low Milestone: 1.4.4
Component: ajax Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:


Any data sent using GET, HEAD or DELETE is ignored. This is inappropriate behavior for DELETE as the spec leaves it open to carrying a data body.

Test Case:
PUT echos as expected, DELETE does not.


Possible Solution:
Remove DELETE from rnoContent (ajax.js:7).

Change History (7)

comment:1 Changed 12 years ago by dmethvin

Can you provide a link to the spec? When researching it I convinced myself DELETE couldn't have a body.

comment:2 Changed 12 years ago by Mal

HTTP 1.1 DELETE Spec can be found here in section 9.7

This question was also asked on StackOverflow, and has a very good answer:

Basic gist of it is that; the only method forbidden from having an entity body is TRACE (see section 9.8 "A TRACE request MUST NOT include an entity."), all other methods offer no such clarity.

Perhaps the ideal solution would be to ban bodies from TRACE, and fallback to checking the contents of data for everything else.

Last edited 12 years ago by Mal (previous) (diff)

comment:3 Changed 12 years ago by dmethvin

Component: unfiledajax
Owner: set to dmethvin
Priority: undecidedlow
Status: newassigned

Ugh, thanks Mal. I agree after reading the spec and SO link.

Right now, $.ajax automagically serializes the data property and appends it to the url string for methods that it thinks can't have a body. We can't do that if everything can have a body.



(Need to see if we can do that sooner to avoid duplication.)

Let's all agree that GET and HEAD can't have a body, no matter what the spec says. That way we can retain url-serialization for data only on GET (which we already do) and HEAD (which I'll fix in the patch).

comment:4 Changed 12 years ago by snover

Regression from what version of jQuery?

comment:5 Changed 12 years ago by mal

Sounds good, happy to help.

It was working as expected in 1.4.2.

comment:6 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

Allow DELETE requests to have a content body, and properly serialize data to the url for HEAD requests. Fixes #7285.

Changeset: 09022e0b09db71259751e7146bb64727615028af

comment:7 Changed 10 years ago by jaubourg

#11586 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.