I have this afterware that was working great till we implemented import { BatchHttpLink } from 'apollo-link-batch-http'. Now I no longer have access to the response headers.
//const httpLink = createHttpLink(
// { uri: GRAPHQL_ENDPOINT, credentials: 'same-origin' }
//)
const httpLink = new BatchHttpLink({
uri: GRAPHQL_ENDPOINT,
credentials: 'same-origin'
})
const afterwareLink = new ApolloLink((operation, forward) => {
return forward(operation).map(response => {
const context = operation.getContext()
const {
response: { headers }
} = context
if (headers) {
const logout = headers.get('logout')
if (logout) {
LocalStorage.removeItem('access_token')
}
}
return response
})
})
const link = ApolloLink.from([
catchErrorLink,
middlewareLink,
afterwareLink,
httpLink
])
The only property that lives on response is "data" holding query results.
Expected Behavior
I would like the BatchHttpLink to return response headers that are exposed by the server. My server is properly exposing it.
Any ETA on when this might get fixed? This is preventing me from being able to use it as well.
@mikebm I've created a PR #852. Hoping this will get merged in although seems unlikely
Most helpful comment
@mikebm I've created a PR #852. Hoping this will get merged in although seems unlikely