Skip to content

Commit b3712f7

Browse files
committed
docs(migration): return after sending 400
This is a change to ensure that users that migrate to v4 do not run `next()` when the response was already sent.
1 parent 037e9ed commit b3712f7

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

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)