You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to set the context of my GraphQL resolvers to ctx.state rather than just ctx. With many other GraphQL server implementations, I could do something like graphqlHTTP({ schema, context: (ctx) => ctx.state }), but this library only allows you to pass a static value as the context.
Since the default context is the Koa ctx, I could just use ctx.state in my resolvers, but I'd prefer to decouple the raw request details from my resolvers since it makes it easier to mock the context in tests.
The text was updated successfully, but these errors were encountered:
I'd like to be able to set the context of my GraphQL resolvers to
ctx.state
rather than justctx
. With many other GraphQL server implementations, I could do something likegraphqlHTTP({ schema, context: (ctx) => ctx.state })
, but this library only allows you to pass a static value as the context.Since the default context is the Koa
ctx
, I could just usectx.state
in my resolvers, but I'd prefer to decouple the raw request details from my resolvers since it makes it easier to mock the context in tests.The text was updated successfully, but these errors were encountered: