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

Only first GraphQL request in a HTTP request is applied #1395

Closed
orpheuslummis opened this issue Apr 23, 2023 · 2 comments · Fixed by #2993
Closed

Only first GraphQL request in a HTTP request is applied #1395

orpheuslummis opened this issue Apr 23, 2023 · 2 comments · Fixed by #2993
Assignees

Comments

@orpheuslummis
Copy link
Contributor

orpheuslummis commented Apr 23, 2023

(not sure this title is clear, but anyway)

I suggest that either it could be giving an error or be documented behavior instead of silently only applying the first query.

e.g. with the HTTP Request sending two GraphQL requests,

query A {
  User {
    _key
  }
}

mutation B {
    create_User(data: "{\"name\": \"Two\", \"age\": 7}") {
      _key
    }
}

only A, the first one, is applied.

@jsimnz
Copy link
Member

jsimnz commented Apr 23, 2023

This is actually basically defined as per the spec: https://spec.graphql.org/June2018/#sec-Executing-Requests

GQL will only execute a single operation. If multiple are given, the need to be named, and you need to specify the name of the operation to run.

Theres an open issue to change this: graphql/graphql-spec#375

@orpheuslummis
Copy link
Contributor Author

orpheuslummis commented Apr 23, 2023

Perhaps a future issue could be made for this, or this issue could be renamed and implemented as "Support GraphQL batching" once a GraphQL spec has it. (It's also possible to implement batching functionality before such a spec lands.)

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