Skip to main content

Bug Tracker

Side navigation

#5764 closed bug (wontfix)

Opened January 06, 2010 11:14PM UTC

Closed November 19, 2010 06:31AM UTC

AJAX requests for XML documents fail if the Content-Type is incorrect

Reported by: bgreenlee Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: ajax xml content-type Cc:
Blocked by: Blocking:
Description

If an XML document is sent with the wrong Content-Type (e.g. "text/html"), jQuery will return a parsererror, even if the response body is valid XML. This issue was discovered via a Rails bug in which cached content (in our case, an XML document) is returned with a Content-Type of "text/html" rather than the original Content-Type. See https://rails.lighthouseapp.com/projects/8994/tickets/1585-action-caching-sets-wrong-content-type-when-cache_path-is-a-string

I have a patch at http://github.com/bgreenlee/jquery/commit/47eaedf87385dd66421ef9126fddc2aaa0303148

Attachments (0)
Change History (2)

Changed January 06, 2010 11:27PM UTC by bgreenlee comment:1

Changed November 19, 2010 06:31AM UTC by snover comment:2

resolution: → wontfix
status: newclosed

Thanks for the report, but this is not a jQuery bug. If the server is failing to provide the proper Content-Type header for XML data as required by the XMLHttpRequest spec, it is not jQuery’s responsibility to try to process the input anyway.