-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-source-graphql) Execute functions in header. #20731
Conversation
Resolves issue gatsbyjs#20690, allowing the use of async functions to define headers for gatsby-source-graphql. To use, functions can be passed in the headers object, i.e: headers { authorization: asyncFunc }.
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.
Thank you for this PR!
I think it would be better if whole headers parameter accepted async function, they are often interdependent. After that change I'd be happy to approve.
See gatsbyjs#20731. Updated README.md to include new (optional) syntax.
Thank you @ajmar! |
Holy buckets, @ajmar — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
* feat(gatsby-source-graphql) Execute functions in headers. Resolves issue #20690, allowing the use of async functions to define headers for gatsby-source-graphql. To use, functions can be passed in the headers object, i.e: headers { authorization: asyncFunc }. * Changes whole headers parameter to accept async function. See gatsbyjs/gatsby#20731. Updated README.md to include new (optional) syntax.
* feat(gatsby-source-graphql) Execute functions in headers. Resolves issue #20690, allowing the use of async functions to define headers for gatsby-source-graphql. To use, functions can be passed in the headers object, i.e: headers { authorization: asyncFunc }. * Changes whole headers parameter to accept async function. See gatsbyjs/gatsby#20731. Updated README.md to include new (optional) syntax.
Description
Allows functions to be passed in the headers object, so that async functions may be used to set the value of headers.
Useful to get the value of the Authorization header before the graphql source is queried (i.e resulting in null data).
Related Issues
Fixes #20690