INNER CODE UNIT · Python
_route_path
roboflow/inference · inference_server/inference_server/app.py:454
def _route_path(scope) -> str:
path = scope.get("path", "")
root_path = scope.get("root_path", "")
if root_path and path == root_path:
return ""
if root_path and path.startswith(root_path + "/"):
return path[len(root_path) :]
return path
class _AuthMiddleware:
"""ASGI middleware for auth — does NOT buffer the request body.
Starlette's @app.middleware("http") with call_next consumes the body
stream before passing to the route, breaking request.stream() in endpoints.
This raw ASGI middleware avoids that by passing receive through untouched.
"""