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

application/graphql content-type support for HTTP POST #273

Closed
linux-china opened this issue Jan 27, 2022 · 1 comment
Closed

application/graphql content-type support for HTTP POST #273

linux-china opened this issue Jan 27, 2022 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@linux-china
Copy link

According to GraphQL Serving over HTTP, If the "application/graphql" Content-Type header is present, treat the HTTP POST body contents as the GraphQL query string.

But following code can not work and 404 error thrown.

POST http://localhost:8080/graphql
Content-Type: application/graphql

query {
  bookById(id: "book-1") {
    id
    name
    pageCount
    author {
      firstName
      lastName
    }
  }
}

You should use application/json instead.

POST http://localhost:8080/graphql
Content-Type: application/json

{
  "query": "query {\n  bookById(id: \"book-1\") {\n    id\n    name\n    pageCount\n    author {\n      firstName\n      lastName\n    }\n  }\n}",
  "variables": null
}

application/graphql has good support for code completion especially in JetBrains IDEs and GraphQL plugin.

@bclozel
Copy link
Member

bclozel commented Jan 27, 2022

Closing as a duplicate of #108

@bclozel bclozel closed this as completed Jan 27, 2022
@bclozel bclozel added the status: duplicate A duplicate of another issue label Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants