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

Remove an edge case where GET requests could be treated as batched #7073

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

glasser
Copy link
Member

@glasser glasser commented Oct 25, 2022

Previously, a GET request whose body was a JSON array with N elements would be interpreted as a batch of the operation specified in the query string repeated N times. Now we just ignore the body for GET requests and never treat them as batched. This matches the Apollo Server 3 behavior.

(You can try to sneak arrays into Apollo Server 3 GETs by using search parameters like query[]=, because AS3 uses the querystring npm package instead of the simpler W3C-style URLSearchParams. But that won't give you "an array of objects with keys like query"; it'll give you "an object with a query key whose value is an array", which isn't enough to make it trigger the batch code.)

Note that Apollo Client Web's batched HTTP link explicitly refuses to send batched operations over GET.

Previously, a `GET` request whose body was a JSON array with N elements
would be interpreted as a batch of the operation specified in the query
string repeated N times. Now we just ignore the body for `GET` requests
and never treat them as batched. This matches the Apollo Server 3
behavior.

(You can try to sneak arrays into Apollo Server 3 GETs by using search
parameters like `query[]=`, because AS3 uses the `querystring` npm
package instead of the simpler W3C-style `URLSearchParams`. But that
won't give you "an array of objects with keys like `query`"; it'll give
you "an object with a `query` key whose value is an array", which isn't
enough to make it trigger the batch code.)

Note that Apollo Client Web's batched HTTP link explicitly refuses to
send batched operations over GET.
@netlify
Copy link

netlify bot commented Oct 25, 2022

Deploy Preview for apollo-server-docs failed.

Name Link
🔨 Latest commit 37d6aad
🔍 Latest deploy log https://app.netlify.com/sites/apollo-server-docs/deploys/635729ffe7f3bb0008bcea69

@glasser glasser enabled auto-merge (squash) October 25, 2022 00:13
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 37d6aad:

Sandbox Source
Apollo Server Typescript Configuration
Apollo Server Configuration

@glasser glasser merged commit e7f524e into main Oct 25, 2022
@glasser glasser deleted the glasser/get-is-never-batched branch October 25, 2022 00:14
@github-actions github-actions bot mentioned this pull request Oct 25, 2022
glasser pushed a commit that referenced this pull request Oct 25, 2022
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/server-integration-testsuite@4.0.3

### Patch Changes

- [#7073](#7073)
[`e7f524eac`](e7f524e)
Thanks [@glasser](https://github.com/glasser)! - Never interpret `GET`
requests as batched. In previous versions of Apollo Server 4, a `GET`
request whose body was a JSON array with N elements would be interpreted
as a batch of the operation specified in the query string repeated N
times. Now we just ignore the body for `GET` requests (like in Apollo
Server 3), and never treat them as batched.

- [#7071](#7071)
[`0ed389ce8`](0ed389c)
Thanks [@glasser](https://github.com/glasser)! - Fix v4 regression:
gateway implementations should be able to set HTTP response headers and
the status code.

- Updated dependencies
\[[`e7f524eac`](e7f524e),
[`0ed389ce8`](0ed389c)]:
    -   @apollo/server@4.0.3

## @apollo/server@4.0.3

### Patch Changes

- [#7073](#7073)
[`e7f524eac`](e7f524e)
Thanks [@glasser](https://github.com/glasser)! - Never interpret `GET`
requests as batched. In previous versions of Apollo Server 4, a `GET`
request whose body was a JSON array with N elements would be interpreted
as a batch of the operation specified in the query string repeated N
times. Now we just ignore the body for `GET` requests (like in Apollo
Server 3), and never treat them as batched.

- [#7071](#7071)
[`0ed389ce8`](0ed389c)
Thanks [@glasser](https://github.com/glasser)! - Fix v4 regression:
gateway implementations should be able to set HTTP response headers and
the status code.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant