Skip to content

Conversation

bendemaree
Copy link
Contributor

@bendemaree bendemaree commented Feb 24, 2018

This addresses the problem raised in #7; when graphql() is invoked, the current context value is not being passed to the executor (via context_value).

Here's a straightforward way to reproduce; if you run with and without the patch here, you'll see two different things printed:

import graphene


class Query(graphene.ObjectType):
    noop = graphene.String()


class Subscription(graphene.ObjectType):
    ping = graphene.String(required=True)

    async def resolve_ping(root, info):
        print(info.context)
        yield "pong"

    async def resolve_player_statistics(root, info):
        pass


schema = graphene.Schema(query=Query, subscription=Subscription)

and (using WsLibSubscriptionServer):

async def handle_subscription(ws, path):
    await subscription_server.handle(ws, request_context={"foo": "bar"})

This will print None and {'foo': 'bar'} before and after this patch, respectively.

@SmileyChris
Copy link
Contributor

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants