Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

On Spring Webflux, invalid json request results in HTTP 500 #524

Closed
@ghost

Description

Describe the bug
On Webflux, attempting to POST invalid JSON results in an HTTP 500.

To Reproduce
POST this request, setting Content-Type:application/json:

"false":true

This returns the following 500 response:

{
    "errors": [
        {
            "code": "INTERNAL_ERROR",
            "message": "The service experienced an internal error. Please try again later.: [details: Cannot construct instance of `graphql.kickstart.execution.GraphQLRequest` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('false')\n at [Source: (String)\"\"false\":true\"; line: 1, column: 1]]"
        }
    ]
}

Expected behavior
The HTTP response should be 4XX (probably 422). Also the error verbiage should obfuscate the internal ObjectMapper error with something more generic (e.g., 'invalid JSON').

Desktop (please complete the following information):

  • OS: Mac Big Sur 11.1
  • Postman 8.0.3

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