I am trying to retrieve a particular request header from an apolloserver request (i.e. the request object from a GraphQLRequestContext), inside a a plugin.
logging the headers
object logs out as:
Headers {
[Symbol(map)]: [Object: null prototype] {
'content-type': [ 'application/json' ],
user: [
'{...(redacted)...}'
],
'x-header-foo': [ '234' ],
accept: [ '*/*' ],
'content-length': [ '256' ],
'user-agent': [ 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' ],
'accept-encoding': [ 'gzip,deflate' ],
connection: [ 'close' ],
host: [ 'localhost:3000' ]
}
}
but headers['x-header-foo']
yields undefined. How do I get the header value? I have not used symbols much so far.