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

Don't return malformed JSON from REST API if serialization failed #999

Merged

Conversation

ZeroErrors
Copy link
Contributor

@ZeroErrors ZeroErrors commented Jun 30, 2023

Previously when generating a reply for the entity and world REST API endpoints, the code ignored any errors, this meant it would send partial JSON data to the client with a 200 OK HTTP response.

This change instead checks if serialization was successful and if not will clear the body of the response and return a 500 Internal server error instead.

@SanderMertens
Copy link
Owner

Thanks for the PR!

@SanderMertens SanderMertens merged commit 424c893 into SanderMertens:master Jul 9, 2023
47 checks passed
@ZeroErrors ZeroErrors deleted the fix-rest-malformed-json branch July 9, 2023 10:48
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.

2 participants