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

Servlet fails to recognize application/graphql when charset is specified #471

Closed
JariNestel opened this issue Aug 16, 2022 · 1 comment
Closed
Labels

Comments

@JariNestel
Copy link

Describe the bug
When sending POST requests to the GraphQL Servlet with Content-Type: application/graphql it works as expected, when specifying a charset with Content-Type: application/grapql; charset=utf-8 it fails to recognize it and tries to handle it as a JSON body instead.

To Reproduce
Steps to reproduce the behavior:

  1. Make any queryable GraphQL Servlet
  2. Query it via POST with Content-Type: application/graphql; charset=utf-8
  3. GraphQLPostInvocationInputParser fails to recognize Content-Type Header

Expected behavior
GraphQLPostInvocationInputParser should be able to handle Content-Type Headers containing additional information like charset

Additional context
Currently checking for Content-Type: application/graphql in GraphQLPostInvocationInputParser happens like this:

if (APPLICATION_GRAPHQL.equals(request.getContentType())) {

I would expect something more like this:

String contentType = request.getContentType();
if (contentType != null && APPLICATION_GRAPHQL.equals(contentType.split(";")[0])) {
@oliemansm
Copy link
Member

Released in v14.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants