Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse data as JSON when content type is application/json #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Parse data as JSON when content type is application/json #63

wants to merge 1 commit into from

Conversation

bostrom
Copy link

@bostrom bostrom commented May 9, 2018

This PR improves the way the response data type is inferred.

Problem: JSON data is not parsed unless the dataType property is set explicitly to json or jsonp.

jQuery specs for the dataType property:

The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).

This PR adds parsing of the response data when the Content-Type response header is application/json, which would more closely mimic the original behaviour of jQuery.

Side note: Tests seem to be broken in master, I added mine, but there were several old tests that don't pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant