You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
GraphQL server respond with HTTP 500 instead of HTTP 400 when malformed request body is received.
To Reproduce
Setup a server with any GraphQL schema.
Send POST request to the server with request body set to "Bad request" or any other invalid Json.
See HTTP 500 error instead of HTTP 400.
Expected behavior
Server should respond with HTTP 400 to malformed requests.
Screenshots
N/A
Desktop (please complete the following information):
OS: Mac OSX
Request sent from Postman
graphql-java 15
graphql-java-servlet 9.1.0
Additional context
HTTP 400 is considered user error indicating that server will not process the request. HTTP 500 is consider backend server error. From production service maintenance point of view any HTTP 500 should be fixed by developers supporting the product. While nothing can be done about clients sending bad requests and those errors can be safely ignored to a degree.
The text was updated successfully, but these errors were encountered:
Malformed requests result in JsonParseException which are caught by the second catch clause.
I think JsonParseExceptions should be treated as bad requests like GraphQLException or be caught sooner and re-thrown as GraphQLExceptions, so that the status is set to 400.
Describe the bug
GraphQL server respond with HTTP 500 instead of HTTP 400 when malformed request body is received.
To Reproduce
Expected behavior
Server should respond with HTTP 400 to malformed requests.
Screenshots
N/A
Desktop (please complete the following information):
Additional context
HTTP 400 is considered user error indicating that server will not process the request. HTTP 500 is consider backend server error. From production service maintenance point of view any HTTP 500 should be fixed by developers supporting the product. While nothing can be done about clients sending bad requests and those errors can be safely ignored to a degree.
The text was updated successfully, but these errors were encountered: