mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Apply path_from_header to entire scope, refs #712
This commit is contained in:
parent
fb0460dd0b
commit
0f217b5e8d
1 changed files with 2 additions and 5 deletions
|
|
@ -742,13 +742,10 @@ class DatasetteRouter(AsgiRouter):
|
||||||
|
|
||||||
async def __call__(self, scope, receive, send):
|
async def __call__(self, scope, receive, send):
|
||||||
path_from_header = self.ds.config("path_from_header")
|
path_from_header = self.ds.config("path_from_header")
|
||||||
path = scope["path"]
|
|
||||||
raw_path = scope.get("raw_path")
|
|
||||||
if path_from_header:
|
if path_from_header:
|
||||||
raw_path = dict(scope["headers"])[path_from_header.encode("utf8")]
|
raw_path = dict(scope["headers"])[path_from_header.encode("utf8")]
|
||||||
if raw_path:
|
scope = dict(scope, raw_path=raw_path)
|
||||||
path = raw_path.decode("ascii")
|
return await super().__call__(scope, receive, send)
|
||||||
return await self.route_path(scope, receive, send, path)
|
|
||||||
|
|
||||||
async def route_path(self, scope, receive, send, path):
|
async def route_path(self, scope, receive, send, path):
|
||||||
# Strip off base_url if present before routing
|
# Strip off base_url if present before routing
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue