Merge pull request #267 from valtyr/graphql-context

Add Request and Response to GraphQL context
This commit is contained in:
2018-12-29 07:05:26 -05:00
committed by GitHub
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -52,6 +52,8 @@ Serve a GraphQL API::
Visiting the endpoint will render a *GraphiQL* instance, in the browser.
You can make use of Responder's Request and Response objects in your GraphQL resolvers through ``info.context['request']`` and ``info.context['response']``.
OpenAPI Schema Support
----------------------
+2 -1
View File
@@ -48,8 +48,9 @@ class GraphQLView:
return
query, variables, operation_name = await self._resolve_graphql_query(req)
context = {"request": req, "response": resp}
result = schema.execute(
query, variables=variables, operation_name=operation_name
query, variables=variables, operation_name=operation_name, context=context
)
result, status_code = encode_execution_results(
[result],