MCPcopy
hub / github.com/encode/starlette / get_route_path

Function get_route_path

starlette/_utils.py:96–111  ·  starlette/_utils.py::get_route_path
(scope: Scope)

Source from the content-addressed store, hash-verified

94
95
96def get_route_path(scope: Scope) -> str:
97 path: str = scope[class="st">"path"]
98 root_path = scope.get(class="st">"root_path", class="st">"")
99 if not root_path:
100 return path
101
102 if not path.startswith(root_path):
103 return path
104
105 if path == root_path:
106 return class="st">""
107
108 if path[len(root_path)] == class="st">"/":
109 return path[len(root_path) :]
110
111 return path

Callers 6

get_pathMethod · 0.90
matchesMethod · 0.90
matchesMethod · 0.90
matchesMethod · 0.90
appMethod · 0.90
test_get_route_pathFunction · 0.90

Calls 1

getMethod · 0.45

Tested by 1

test_get_route_pathFunction · 0.72