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

Handling of empty response body for error response codes #25

Open
alex-tsx opened this issue Dec 6, 2022 · 0 comments
Open

Handling of empty response body for error response codes #25

alex-tsx opened this issue Dec 6, 2022 · 0 comments

Comments

@alex-tsx
Copy link

alex-tsx commented Dec 6, 2022

It is seen here, that we evaluate response.data identically for 'success' & error response codes.

In case of 404 error and when await response.text() === '', reading await response.json() throws an error

SyntaxError: Unexpected end of JSON input

The default axios XHR adapter behaves differently & won't throw in this case. With this adapter I have to look into caught error message text at this point.

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

No branches or pull requests

1 participant