Bug Tracker

Modify

Ticket #5764 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

Change History

comment:1 Changed 4 years ago by bgreenlee

comment:2 Changed 3 years ago by snover

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

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.