-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support body-parser options when configuring GraphQL #7591
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 1d4f41b The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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 1d4f41b:
|
@@ -48,6 +48,7 @@ const addApolloServer = async ({ | |||
app: server, | |||
path: config.graphql?.path || '/api/graphql', | |||
cors: false, | |||
bodyParserConfig: config.graphql?.bodyParser === undefined ? true : config.graphql?.bodyParser, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is true
equivalent to the default? and if so, why doesn't just config.graphql?.bodyParser
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
is equivalent to the express
defaults, and anything !== false
is explicitly provided.
That said, reading https://github.com/expressjs/body-parser/blob/1f6f58e1f8dc222f2b6cfc7eb3a3bf5145ff2b56/lib/types/json.js#L51 - it doesn't matter anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than adding a changeset, this looks good to me
e8155dd
to
1e991f4
Compare
e34f058
to
9e1241a
Compare
d3c5f97
to
acbfba6
Compare
Following the discussion in #7582
body-parser
has a number of configuration options that may be useful for developers to configure themselves. It looks like Apollo 4 will be changing how express interacts with user code in future so we'll need to do this anyway; might as well do it now.