Skip to content
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

Fetcher and Headers should be mutable per request. #184

Open
ayazemre opened this issue Aug 27, 2024 · 3 comments
Open

Fetcher and Headers should be mutable per request. #184

ayazemre opened this issue Aug 27, 2024 · 3 comments

Comments

@ayazemre
Copy link

Hello,

Thank you for the great library. I hit couple roadblocks. When I create client on client side it works great. When I need to write tests I need to add custom headers, this is not allowed after client is created. Also for fullstack frameworks like SvelteKit, we have custom fetcher on the server side which works as event bus. I need to reinstantiate the client on server side, which seems unnececssary. I think it would be helpful to have client created with given data but when you do a query or mutation I should be able to individually set those parameters per request for edge cases. I can edit the library myself but need to fork it then. What do you think about this request?

Copy link

linear bot commented Aug 27, 2024

@remorses
Copy link
Owner

You can pass a function for headers to change them

https://genql.dev/docs/usage/create-the-client#e670ccc1623a47bfa6a482a297e03f47

@remorses
Copy link
Owner

Instantiating a new client is a cheap operation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants