[BugFix] KeyError on scope["method"] for realtime api websocket in AuthenticationMiddleware (#36934)
Signed-off-by: daniebrill <50454544+daniebrill@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent
ed33310552
commit
f2145efcb6
@@ -69,7 +69,10 @@ class AuthenticationMiddleware:
|
|||||||
return token_match
|
return token_match
|
||||||
|
|
||||||
def __call__(self, scope: Scope, receive: Receive, send: Send) -> Awaitable[None]:
|
def __call__(self, scope: Scope, receive: Receive, send: Send) -> Awaitable[None]:
|
||||||
if scope["type"] not in ("http", "websocket") or scope["method"] == "OPTIONS":
|
if (
|
||||||
|
scope["type"] not in ("http", "websocket")
|
||||||
|
or scope.get("method") == "OPTIONS"
|
||||||
|
):
|
||||||
# scope["type"] can be "lifespan" or "startup" for example,
|
# scope["type"] can be "lifespan" or "startup" for example,
|
||||||
# in which case we don't need to do anything
|
# in which case we don't need to do anything
|
||||||
return self.app(scope, receive, send)
|
return self.app(scope, receive, send)
|
||||||
|
|||||||
Reference in New Issue
Block a user