Skip to content

Commit

Permalink
Fix the asgi handler's scope argument type (strawberry-graphql#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorJohn authored Jul 31, 2024
1 parent 6415e67 commit 7818c39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Release type: patch

This release fixes the type of the ASGI request handler's `scope` argument, making type checkers ever so slightly happier.
6 changes: 3 additions & 3 deletions strawberry/asgi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ def __init__(
else:
self.graphql_ide = graphql_ide

async def __call__(self, scope: Request, receive: Receive, send: Send) -> None:
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] == "http":
return await self.handle_http(scope, receive, send) # type: ignore
return await self.handle_http(scope, receive, send)

elif scope["type"] == "websocket":
ws = WebSocket(scope, receive=receive, send=send) # type: ignore
ws = WebSocket(scope, receive=receive, send=send)
preferred_protocol = self.pick_preferred_protocol(ws)

if preferred_protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
Expand Down

0 comments on commit 7818c39

Please sign in to comment.