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

Returning empty response body causes unexpected errors #1422

Open
jfbrennan opened this issue Nov 27, 2024 · 0 comments
Open

Returning empty response body causes unexpected errors #1422

jfbrennan opened this issue Nov 27, 2024 · 0 comments

Comments

@jfbrennan
Copy link

jfbrennan commented Nov 27, 2024

The Mail Send v3 API supports JSON, but on a successful request the response body comes back empty, which is bad practice for JSON endpoints. What happens is:

const json = await response.json(); // <--- "SyntaxError: Unexpected end of JSON input"

JSON endpoints should, at a minimum, return a JSON-compatible response, even an empty string would prevent this unexpected error. See https://developer.mozilla.org/en-US/docs/Web/API/Response/json#return_value

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