Bug Tracker

Opened 7 years ago

Closed 6 years ago

#5764 closed bug (wontfix)

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:


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

Change History (2)

comment:1 Changed 7 years ago by bgreenlee

comment:2 Changed 6 years ago by snover

  • Resolution set to wontfix
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.