Closed marcogbarcellos closed 5 years ago
I hadn't try it yet, but maybe you can set on the context a new object with the req
and also there with the headers. I think that doing that we can mock the request.
Here is a post from Apollo that maybe can be useful.
It can be something like
const context = {
req: {
authorization: 'Bearer JWT AshufewmrgfddJWT_TOKEN_EX'
}
}
tester.graphql(query, undefined, context, { isLocal: false })
.then(result => console.log(result))
.catch(err => console.log(err))
@marcogbarcellos does it works for you?
Can we close this issue?
Yeah it worked! thanks!
I was wondering if we have a way to setup header properties through the
.graphql
function. I'm using apollo server and it seems that using it is bypassing some middlewares(like authentication/authorization stuff).example on what would be nice to have: