Skip to main content

Bug Tracker

Side navigation

#10527 closed bug (fixed)

Opened October 18, 2011 09:56PM UTC

Closed March 07, 2012 04:38PM UTC

Last modified December 13, 2012 10:19PM UTC

AJAX deferred should call success on "No Content," even when a Content-Type is specified

Reported by: lucas.madar@gmail.com Owned by: lucas.madar@gmail.com
Priority: low Milestone: None
Component: ajax Version: 1.6
Keywords: needsreview Cc: jaubourg
Blocked by: Blocking:
Description

When a Content-Type such as "text/xml" is specified in an HTTP 204 ("No Content") status, jquery finds a converter for the datastream in the ajaxConvert() function. This ends up calling parseXML, which creates an invalid XML document and jquery throws an error.

In a 204 No Content situation, jquery should not attempt to parse the empty document. Or, parseXML should return an empty document when passed an empty string.

Attachments (0)
Change History (9)

Changed October 19, 2011 10:59AM UTC by addyosmani comment:1

cc: → jaubourg
component: unfiledajax
priority: undecidedlow

Changed October 19, 2011 03:21PM UTC by timmywil comment:2

owner: → lucas.madar@gmail.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case to help us assess your ticket.

Additionally, be sure to test against the git version to ensure the issue still exists.

Changed November 03, 2011 08:11AM UTC by trac-o-bot comment:3

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed November 03, 2011 01:28PM UTC by dmethvin comment:4

resolution: invalid
status: closedreopened

Changed November 05, 2011 09:37PM UTC by timmywil comment:5

keywords: → needsreview
status: reopenedopen

Changed March 07, 2012 04:38PM UTC by jaubourg comment:6

resolution: → fixed
status: openclosed

Makes parseXML act like parseJSON when given an empty or non-string input: now returns null rather than throwing an exception. Incidently fixes #10527. Unit tests added.

Changeset: d30859eb6bd5af9aafa9db003e17835ff594d019

Changed June 14, 2012 04:36PM UTC by lucas.madar@gmail.com comment:7

It looks like this has been fixed in 1.7.2. For anyone trying to work around this in a previous version, I found that forcing the datatype to 'text' in an ajax query works.

Changed December 13, 2012 09:52PM UTC by anonymous comment:8

This is still broken in 1.7.2 when using 'jsonp' dataType.

Changed December 13, 2012 10:19PM UTC by jaubourg comment:9

Replying to [comment:8 anonymous]:

This is still broken in 1.7.2 when using 'jsonp' dataType.

jsFiddle use-case please.