Open Pacane opened 7 months ago
Ferry does not currently support this on a per request basis directly, but you can add a Link() in front of your HttpLink() that adds the Context entities (ferry used the same system as Artemis under the hood for this).
You could also have the custom link add the headers conditionally, e.g. only for specific requests.
An example link this handles authentication via headers is here: https://github.com/gql-dart/gql/blob/master/examples/gql_example_http_auth_link/lib/http_auth_link.dart
Hello there 👋 I am interested in passing a Context. How can we add ContextEntries to requests @knaeckeKami ?
I think it can not be done because ferry generated code is:
@override
Request get execRequest => Request(
operation: operation,
variables: vars.toJson(),
);
...which can not be passed a context
😅 I'll opened a feature request.
Hi,
I'd like to be able to pass specific headers on a per request base. I know I can do this by re-creating a client using another
HttpLink
with the headers I want to pass, but is there a way to do this with an existing client?I used to use Artemis and we could pass in the
Context
onexecute
, which allowed me to override the headers in the request. Is there such a feature within Ferry?