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

GraphiQL #3

Open
ronen1malka opened this issue Mar 25, 2019 · 1 comment
Open

GraphiQL #3

ronen1malka opened this issue Mar 25, 2019 · 1 comment

Comments

@ronen1malka
Copy link

How can I use GraphiQL to query?
I can query using Postman, but GraphiQL show and error:

{
  "errors": [
    {
      "message": "Invalid Syntax",
      "locations": [
        {
          "line": 1,
          "column": 1
        }
      ],
      "errorType": "InvalidSyntax"
    }
  ],
  "data": null,
  "extensions": null
}

And in the app console I can see the following error:
graphql.GraphQL : Executing request. operation name: null. Request: {"query":"{\n\n\n\tbook (id: \"111\"){\n\t\tisn\n\t\ttitle\n\t\tauthors\n\t}\n\n\n}","variables":null,"operationName":null}

It seems that GraphiQL add "query" at the top of the request.

@MacNale
Copy link

MacNale commented Feb 9, 2021

Here is the graphQL documentation -

image

In order to support "application/graphql" content type header, it needs to treat the HTTP POST body contents as the GraphQL query string.

It looks like, "query" is treated as JSON instead of GraphQL query.

Checkout - https://stackoverflow.com/a/56615072/2500390

kvv1968 added a commit to kvv1968/spring-boot-graphql-query-example that referenced this issue Jun 18, 2023
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