Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13525 closed bug (notabug)

ajax: incorrect/inconsistent handling of 204 NO CONTENT and 205 RESET CONTENT

Reported by: yaniv@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

As you can see here (https://github.com/jquery/jquery/blob/master/src/ajax.js#L628), $.ajax has special handling for HTTP 204 responses thus that no attempt is made to convert their body (because as per the RFC, 204 responses MUST NOT have a body).

No such special casing is done for 205 RESET CONTENT responses, which also MUST NOT have a body, thus that 205 responses received with a Content-Type that should be converted fail unexpectedly (their fail() handler is called instead of done()).

IMHO, the trivial and obvious fix is to add a similar special case for 205 responses. Since I'm not a regular contributor, I doubt a pull request is worth the extra for to produce one.

Also, see here (http://jsfiddle.net/Sj3a6/2/) for a small jsfiddle+heroku app combo that demonstrates the problem.

Change History (2)

comment:1 Changed 7 years ago by yaniv@…

I believe this (http://trac.tools.ietf.org/wg/httpbis/trac/ticket/88) ticket, along with the proposed amendment to rfc2616, clarifies the intended difference between 204 and 205. This isn't a bug in jQuery, and this ticket should be closed.

comment:2 Changed 7 years ago by timmywil

Resolution: notabug
Status: newclosed

Thank yaniv

Note: See TracTickets for help on using tickets.