We have a use case where we want to process HTTP headers and/or status code along with the GraphQL errors for a response. The callback for each of HTTPNetworkTransportTaskCompletedDelegate and HTTPNetworkTransportGraphQLErrorDelegate only contains information belonging to that layer, which is the right design. However, that means I won't receive information from different layers in one callback.
I propose that we add a per request context object to HTTPNetworkTransport. This mutable context object can hold attribute objects identified by string keys. This context object will be passed in every delegate callback for the request/response. This is a common technique to allow processors in multiple layers to coordinate. I think this is a great enhancement to the client library and is not difficult to implement.
With this support, we can set the header value to the context when we receive the callback through the interface of HTTPNetworkTransportTaskCompletedDelegate, then retrieve this value from the context when we process the callback for HTTPNetworkTransportGraphQLErrorDelegate.
This issue is a follow up to #1116.
We have a use case where we want to process HTTP headers and/or status code along with the GraphQL errors for a response. The callback for each of
HTTPNetworkTransportTaskCompletedDelegateandHTTPNetworkTransportGraphQLErrorDelegateonly contains information belonging to that layer, which is the right design. However, that means I won't receive information from different layers in one callback.I propose that we add a per request context object to
HTTPNetworkTransport. This mutable context object can hold attribute objects identified by string keys. This context object will be passed in every delegate callback for the request/response. This is a common technique to allow processors in multiple layers to coordinate. I think this is a great enhancement to the client library and is not difficult to implement.With this support, we can set the header value to the context when we receive the callback through the interface of
HTTPNetworkTransportTaskCompletedDelegate, then retrieve this value from the context when we process the callback forHTTPNetworkTransportGraphQLErrorDelegate.This issue is a follow up to #1116.