nearform/graphql-hooks

Add response headers to client response

Closed this issue · 0 comments

Description

Currently the only way to access response headers is from responseReducer because it gets passed the entire response before generateResult is called on it. That doesn't scale well because it needs to be set on every single query which leads to repetitive code and lack of unification. Accessing the response headers from middleware or query state is useful for many use cases. One of them is logging middleware which in case of an error might want to capture trace headers from the response.

Suggested implementation

Add headers to generateResult return value