Skip to content

Commit

Permalink
fix: support starlette 0.33 (#413)
Browse files Browse the repository at this point in the history
path now includes root_path so we need a different way to
remove it. It seems like route_root_path gives this information.

See encode/starlette#2361
encode/starlette#2352
encode/starlette#1336
  • Loading branch information
maartenbreddels committed Dec 8, 2023
1 parent 7125ec4 commit a6b2a29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion solara/server/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ async def root(request: Request, fullpath: str = ""):
if settings.main.root_path is None:
# use the default root path from the app, which seems to also include the path
# if we are mounted under a path
root_path = request.scope.get("root_path", "")
scope = request.scope
root_path = scope.get("route_root_path", scope.get("root_path", ""))
logger.debug("root_path: %s", root_path)
# or use the script-name header, for instance when running under a reverse proxy
script_name = request.headers.get("script-name")
Expand Down

0 comments on commit a6b2a29

Please sign in to comment.