-
Notifications
You must be signed in to change notification settings - Fork 307
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
I want the GraphQLClient instance to return response headers along with data #641
Comments
Is there place to discuss with other users? |
Are you saying you want to extend |
I later found out, that using rawRequest provides response headers and all other data. Unfortunately, the auto generated "getSdk" has TS errors in that case, plus some other issues. I don't have access to that code anymore, so I don't recall the exact issues. |
What
I am looking for a way to append the response headers to all responses from my GraphQLClient instance.
Does anyone know how to do that?
I have this setup in a very large application:
The 'getSdk' wrapper comes from "@graphql-codegen" which generates TS types from the backend's graphql schema.
We use that exported
graphQLClient
in hundreds of places allover the application UI.Why
I need to access the response headers in all the places that consume the GraphQLClient instance. If there is something to be logged or an error in the data, I need to use the "traceparent" header from the client and display it.
How
I thought that
responseMiddleware
could help with that, the headers are in there as theresponse: GraphQLClientResponse<T>
argument to theresponseMiddleware
method.But as the responseMiddleware doesn't get to return anything, I don't get to modify what is passed down the line. Sure, I can modify the 'data' part but that's a hack. Ideally, I'd like the client to return both data and headers.
The text was updated successfully, but these errors were encountered: