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

Fix v4.2.0 regression in variables: null (et al) #7203

Merged
merged 1 commit into from Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/red-cats-clap.md
@@ -0,0 +1,6 @@
---
'@apollo/server-integration-testsuite': patch
'@apollo/server': patch
---

Fix v4.2.0 (#7171) regression where `"operationName": null`, `"variables": null`, and `"extensions": null` in POST bodies were improperly rejected.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/integration-testsuite/package.json
Expand Up @@ -36,7 +36,7 @@
"@josephg/resolvable": "^1.0.1",
"body-parser": "^1.20.0",
"express": "^4.18.1",
"graphql-http": "1.8.0",
"graphql-http": "1.9.0",
"graphql-tag": "^2.12.6",
"loglevel": "^1.8.0",
"node-fetch": "^2.6.7",
Expand Down
3 changes: 3 additions & 0 deletions packages/server/src/runHttpQuery.ts
Expand Up @@ -155,6 +155,7 @@ export async function runHttpQuery<TContext extends BaseContext>({

if (
'extensions' in httpRequest.body &&
httpRequest.body.extensions !== null &&
!isStringRecord(httpRequest.body.extensions)
) {
throw new BadRequestError(
Expand All @@ -164,6 +165,7 @@ export async function runHttpQuery<TContext extends BaseContext>({

if (
'variables' in httpRequest.body &&
httpRequest.body.variables !== null &&
!isStringRecord(httpRequest.body.variables)
) {
throw new BadRequestError(
Expand All @@ -173,6 +175,7 @@ export async function runHttpQuery<TContext extends BaseContext>({

if (
'operationName' in httpRequest.body &&
httpRequest.body.operationName !== null &&
typeof httpRequest.body.operationName !== 'string'
) {
throw new BadRequestError(
Expand Down