Skip to content

GraphQL should reply with HTTP 415 for unsupported content type #41675

@nictas

Description

@nictas

Hi,

I receive a 404 response when I try to make a request to the /graphql endpoint with a wrong content type (text/plain, for example):

{
	"timestamp": "2024-07-31T15:49:28.136+00:00",
	"status": 404,
	"error": "Not Found",
	"path": "/graphql"
}

image

This is a bit confusing because it leads you to think that there's something wrong with the GraphQL configuration in the application, whereas the actual problem is with the request.

I'm using version 3.3.2 of spring-boot-starter-graphql. The problem should be reproducible with any sample project but I'll attach my own just in case:
graphql-demo.zip

You can execute a GraphQL request with the following body to reproduce the issue:

{"query":"query getCurrentUser {\n\tgetCurrentUser \n}","operationName":"getCurrentUser"}

The authentication is basic with a username of "user" and the password written in the application logs.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions