Skip to content

Commit bbc5a6c

Browse files
authored
raise an exception for non-http scopes in the Starlette middleware (#1185)
fixes #1184
1 parent c837984 commit bbc5a6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

elasticapm/contrib/starlette/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ async def __call__(self, scope, receive, send):
130130
receive: receive awaitable callable
131131
send: send awaitable callable
132132
"""
133+
# we only handle the http scope, raise an exception for anything else
134+
# see https://www.uvicorn.org/#the-asgi-interface
135+
assert scope["type"] == "http"
133136

134137
@functools.wraps(send)
135138
async def wrapped_send(message):

0 commit comments

Comments
 (0)