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

Only dispatch event with json/text payload #23

Closed
wants to merge 1 commit into from

Conversation

@koddsson
Copy link
Member

commented Aug 13, 2019

The reason why we only used responses with Content-Type: text/html; fragment in the past is because rails would return HTML errors when something was wrong and the <auto-check> component would happily cram it into the warning note.

We regressed this behavior in #18. This PR bring back a similar behavior by only dispatching an error event payload if it's JSON or text.

Ref: github/github#87161 (comment)

@koddsson koddsson requested a review from github/web-systems-reviewers Aug 13, 2019

@koddsson

This comment has been minimized.

Copy link
Member Author

commented Aug 13, 2019

We could also add the content type header to the payload and let the application decide what to do. What do you think @muan ?

if (error.contentType.includes('application/json')) {
validity = JSON.parse(error.responseText).text
} else {
} else if (error.contentType.includes('text/plain')) {

This comment has been minimized.

Copy link
@koddsson

@koddsson koddsson closed this in #24 Aug 27, 2019

@dgraham dgraham deleted the only-support-html-and-text branch Sep 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.