-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add httpResponse property to GraphQLResponse object in order to get access to its headers #223
Conversation
…tpResponse's headers
@TomaszWlodarczyk: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
Thanks for submitting a PR! I don't think we can expose the HTTP response on the Maybe we can add a more generic context to |
The thing is that we pass over from backend to the app a unique response ID as a custom HTTP header in order to trace it later in case of any issues. That's why I need to have an access to that. Is there any other way to do so? But you do that in case of response failure anyway.... Anyway adding all headers from HTTPResponse to |
Regarding generalization of network transport, one way of handling this could be to have the response as an enum (of transports) with associated data. This new enum could then be associated with the server value of the GraphQLResult.Source to be available to the client. |
Is there any chance that you address that in near future? |
I also agree that HTTP headers should be specific to the Another alternative would to be to have a delegate protocol on |
@MrAlek yeah that would work! |
To avoid having the client coordinate between two async callbacks (headers and the normal response) and to support multiple transports, the following could also be considered. The main idea is to have the enum Source take associated data (new TransportMessage) for the server value and the TransportMessage is itself an enum. See attachment. |
Any ETA for introducing that? |
I have added the proposal based on GraphQLResult.Source to https://github.com/knutaa/apollo-ios. Should be possible to test based on that branch. But believe some agreement is needed on design before this is progressed |
Hmmm, I don't really like the idea of coupling the type Context = [String: Any]
func networkTransport(_ networkTransport: HTTPNetworkTransport, contextFor response: HTTPURLResponse): Context And then we could pass through the returned context to |
I've just recently started using Apollo, so I don't have any super smart suggestions. At first glance, I'd think the most natural place to put a Anyway, in my case I deal with data for real-time public transportation, converting departure times to "departs in X minutes", and it is very important to be able to access the server's |
I have created a new PR #266 based on the suggested use of context. But without use of the suggested delegate. Not sure if that is adding required flexibility as this time. |
Hey deleted account friend - Thank you for doing this, and sorry for the long radio silence on our end! Unfortunately since so much has changed since this PR was opened, I'm going to close this in favor of the work happening in #602 to implement this feature. Please feel free to chime in there if you have thoughts or questions, and open issues on anything you feel we may be leaving out. |
No description provided.