mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Handle scope path if it is a string
I ran into this while running a unit test with httpx.AsyncClient
This commit is contained in:
parent
4933035b75
commit
dc80e779a2
1 changed files with 5 additions and 1 deletions
|
|
@ -48,7 +48,11 @@ class Request:
|
||||||
if "raw_path" in self.scope:
|
if "raw_path" in self.scope:
|
||||||
return self.scope["raw_path"].decode("latin-1")
|
return self.scope["raw_path"].decode("latin-1")
|
||||||
else:
|
else:
|
||||||
return self.scope["path"].decode("utf-8")
|
path = self.scope["path"]
|
||||||
|
if isinstance(path, str):
|
||||||
|
return path
|
||||||
|
else:
|
||||||
|
return path.decode("utf-8")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def query_string(self):
|
def query_string(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue