-
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
How to access a response header in the FetchResponse (client side) #12265
Comments
The problem here is that Apollo Client is a GraphQL client and doesn't really know about HTTP concepts outside of the Link chain - the query could be made any number of different ways, http only being one of them. Your second attempt (adding it to the response data) could work, but would need quite a lot more work:
|
going to try your suggestion thanks, I am surprised there is no access to the response headers given the client is making an http request |
@phryneas for your first two points, is that done in the query definition 'SelectionSet' and 'loc' ? |
As I said, the Client is agnostic to the transport method you are using, which is why it's not aware of this. You could also e.g. use WebSockets for this - the Client is a pure GraphQL client, not a HTTP Client.
Yes! As examples you can see the
Yes, your |
Can anyone advise how I can retrieve a response header in my client (React Code) - I am using the useQuery hook but it seems rather limited.
Ive also tried modifying the response data returned back to the client (see 'Modifying response data' from https://www.apollographql.com/docs/react/networking/advanced-http-networking) with an extra field returned back but it seems to be readonly.
The text was updated successfully, but these errors were encountered: