Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the asgi handler's scope argument type #3581

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
DoctorJohn marked this conversation as resolved.
Show resolved Hide resolved
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
Loading