-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow apollo-boost to support headers and credentials #3098
Conversation
@rzane: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
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.
Hi @rzane! Thanks for making this PR. Since you can already configure headers and credentials, I'm not going to merge this.
You can set headers and credentials either statically by passing them as fetchOptions
or dynamically by setting them on the context of the operation with the request
function. Does that make sense?
Hi @peggyrayzis, I'm pretty confident that static headers can't be passed through I've created a repro of that issue here: https://gist.github.com/rzane/d6691acf7d4a60dd3a31389ced72b6de To demonstrate the problem, run the following commands:
|
We're also running same behavior with |
The line that writes header settings Apollo Bost L77 |
@peggyrayzis, can we reopen this PR? |
@peggyrayzis this is still broken and makes |
What's the update on this guys ? Static headers still can't be passed through |
@theochampion This will be merged shortly. There is still some work to do here with regards to testing, but I'm planning on having it done today (which means it will be in next Tuesday's release). |
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.
We should be all set here - thanks for kickstarting this PR @rzane!
@hwillson any idea when this is expected to be in any of release tag? |
@thecodejack We're releasing a new version later today! 🙂 |
i waited the entire day for the new version ... is it yesterday or still today? |
@hwillson i don't see the release..can we expect still the release later today? |
@wowzaaa @thecodejack Sorry, yesterday 💯% got away from me! |
Thanks ..it is helping 👍 |
@@ -74,7 +76,8 @@ export default class DefaultClient<TCache> extends ApolloClient<TCache> { | |||
const httpLink = new HttpLink({ | |||
uri: (config && config.uri) || '/graphql', | |||
fetchOptions: (config && config.fetchOptions) || {}, | |||
credentials: 'same-origin', | |||
credentials: (config && config.credentials) || 'same-origin', | |||
headers: (config && config.headers) || {}, |
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.
These should probably have been part of fetchOptions, right? That's the way it's documented.
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.
I have lost a night trying to figure this out. It is simply in the wrong place...
Since the beginning I was inserting it inside fetchOptions.... 😡
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.
I also had this issue, the documentation should be clear to place credentials in the root and not fetchOptions as if placed in fetchOptions it will be overwritten by the root credentials whicih defaults to 'same-origin'
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.
Just had the same problem today... =/
Apollo Boost should allow you to pass in headers and credentials. Currently
credentials
is hardcoded tosame-origin
and it's not possible to set request headers.