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

Sending malformed Query request results in HTTP 500 instead of HTTP 400 #555

Open
chetansj27 opened this issue Jun 19, 2024 · 2 comments
Open

Comments

@chetansj27
Copy link

Expected Behavior

Server should respond with HTTP 400 to malformed requests.
image
Instead of RuntimeException if we can throw JsonParseException then it will be easy to handle that error in GlobalErrorHandler because RuntimeException is very generic and if we handle RuntimeException then it will handle other exceptions also.

Actual Behaviour

Unexpected error occurred: Error deserializing object from JSON: Unexpected character ('q' (code 113)): was expecting double-quote to start field name
at [Source: (byte[]) with 500 error.

Steps To Reproduce

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.

Environment Information

OS: Windows
Request sent from Postman
micronaut-graphql version=4.1.4

Example Application

No response

Version

4.1.4

@graemerocher
Copy link
Contributor

Would you be willing tot send a PR?

@chetansj27
Copy link
Author

Yes, I will be happy to raise PR. Will raise PR by EOD

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

2 participants