Skip to content

Sending malformed POST request results in HTTP 500 instead of HTTP 400 #258

Closed
@artem-ag

Description

@artem-ag

Describe the bug
GraphQL server respond with HTTP 500 instead of HTTP 400 when malformed request body is received.

To Reproduce

  1. Setup a server with any GraphQL schema.
  2. Send POST request to the server with request body set to "Bad request" or any other invalid Json.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions