Skip to content

Commit 9dd92ee

Browse files
authored
Merge pull request #8031 from slagiewka/migration_middleware_return
docs(migration): return after sending 400
2 parents 5524c55 + 16f573a commit 9dd92ee

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

.changeset/thick-seals-tan.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apollo/server': patch
3+
---
4+
5+
Add return after sending 400 response in doubly escaped JSON parser middleware

docs/source/migration.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ app.use((req, res, next) => {
11211121
} catch (e) {
11221122
// https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#json-parsing-failure
11231123
res.status(400).send(e instanceof Error ? e.message : e);
1124+
return;
11241125
}
11251126
}
11261127
next();

packages/server/src/__tests__/express4/expressSpecific.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ it('supporting doubly-encoded variables example from migration guide', async ()
163163
} catch (e) {
164164
// https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#json-parsing-failure
165165
res.status(400).send(e instanceof Error ? e.message : e);
166+
return;
166167
}
167168
}
168169
next();

0 commit comments

Comments
 (0)