Add an optional 'customHeaders' field to AWSAppSyncClientOptions to easily add headers to requests#469
Add an optional 'customHeaders' field to AWSAppSyncClientOptions to easily add headers to requests#469babouinette wants to merge 2 commits intoawslabs:masterfrom
Conversation
|
I rather not have this, in our case our custom header is not known until called. |
is there a better way to do this? like pass headers(tokens) only during mutate or query? |
For us, we only know it during the query, every query needs different header, maybe allow the query to be set during runtime? |
|
client.mutate({ mutation: mutationName, context: { why is this not helping you? it worked for me |
|
How did you do |
|
@pickfire using AWSAppSyncClient |
|
I don't use that directly. Also, I left the company working on this already. |
Description of changes:
This change allows passing a customHeaders argument to AWSAppSyncClientOptions to easily add headers to requests, by using the 'headers' field in createHttpLink.
For example, to add an authorization header, instead of doing this :
We could do this :
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.