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

return 200 for blocked JSONP requests #214

Merged
merged 1 commit into from
Apr 11, 2018
Merged

return 200 for blocked JSONP requests #214

merged 1 commit into from
Apr 11, 2018

Conversation

jmhodges
Copy link
Owner

Turns out, when you do a <script src="yadda?callback=parseTLSThing">, the script
won't run if a 4xx error code is returned. So, in order for folks to show errors
to their users, and not just quietly log in their console, we have to return 200
OK even on blocked domains.

To be clear, normal AJAX requests would work, but people do that script tag
thing to be JSONP-y.

This patch also includes some new tests (and, along the way, a refactoring of
the current ones).

Turns out, when you do a <script src="yadda?callback=parseTLSThing">, the script
won't run if a 4xx error code is returned. So, in order for folks to show errors
to their users, and not just quietly log in their console, we have to return 200
OK even on blocked domains.

To be clear, normal AJAX requests would work, but people do that script tag
thing to be JSONP-y.

This patch also includes some new tests (and, along the way, a refactoring of
the current ones).
@jmhodges jmhodges merged commit c7c09bc into master Apr 11, 2018
@jmhodges jmhodges deleted the jsonp_error branch April 11, 2018 17:17
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