diff --git a/examples/graphiql.py b/examples/graphiql.py index 8363203..51f0514 100644 --- a/examples/graphiql.py +++ b/examples/graphiql.py @@ -15,6 +15,8 @@ class User: class Query: @strawberry.field def user(self) -> Optional[User]: + # self.context is an dict with headers, query, and params properties + # headers and query are dict and params an array with route parameters return User(name="Hello") diff --git a/examples/middleware.py b/examples/middleware.py index dd4de03..77209a0 100644 --- a/examples/middleware.py +++ b/examples/middleware.py @@ -11,6 +11,7 @@ async def auth(res, req, data=None): user = await get_user(req.get_header('authorization')) if not user: res.write_status(403).end("not authorized") + #returning Falsy in middlewares just stop the execution of the next middleware return False #returns extra data