]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Align __getitem__ type with scope type (#1118)
authorSam Burba <github@samburba.com>
Sat, 18 Sep 2021 13:16:05 +0000 (06:16 -0700)
committerGitHub <noreply@github.com>
Sat, 18 Sep 2021 13:16:05 +0000 (15:16 +0200)
Scope does not only contain strings, see full spec here:
https://asgi.readthedocs.io/en/latest/specs/www.html#websocket-connection-scope

Fixes #1117

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
starlette/requests.py

index f88021645c9b4a1b9a07ac3c5eeb629a969394a2..676f4e9aa3fec50df942c46053e991b78074cf26 100644 (file)
@@ -65,7 +65,7 @@ class HTTPConnection(Mapping):
         assert scope["type"] in ("http", "websocket")
         self.scope = scope
 
-    def __getitem__(self, key: str) -> str:
+    def __getitem__(self, key: str) -> typing.Any:
         return self.scope[key]
 
     def __iter__(self) -> typing.Iterator[str]: