Closed
Description
What's the right way to get request header when resolving a query/mutation? A related issue, #17, lead me to believe that info.context.headers
will work but I'm finding that doesn't exist when I try to print it:
❮❮❮ curl -i -H 'Content-Type: application/json' -H 'x-authorization-info: testing' -X POST -d '{"query": "query { latestSnapshot { url } }"}' http://localhost:5000/graphql
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 160
Server: Werkzeug/0.14.1 Python/3.6.7
Date: Thu, 18 Apr 2019 22:21:51 GMT
{"errors":[{"message":"'dict' object has no attribute 'headers'","locations":[{"line":1,"column":9}],"path":["latestSnapshot"]}],"data":{"latestSnapshot":null}}%
with a resolver of:
def resolve_latest_snapshot(self, info: ResolveInfo, org_id: Optional[int] = None) -> models.Snapshot:
print(info.context.headers)
# more stuff
I have flask-graphql version 2.0.0.
EDIT: other related packages I have:
graphene==2.1.3
graphql-core==2.1
graphql-relay==0.4.5
graphql-server-core==1.1.1
graphene-sqlalchemy==2.1.1
Metadata
Metadata
Assignees
Labels
No labels