Closed gabriel-f-santos closed 3 months ago
Issue: https://github.com/encode/starlette/issues/2599 Discussion: https://github.com/encode/starlette/discussions/2495
Change regex used to remove root_path to consider only the root path without match simillar endpoint that contains the root_path as substring. ex:
root_path = "product" scope["path"] = "products/all"
before:
re.sub(r"^" + root_path, "", scope["path"]) -> 's/all'
after:
re.sub(r"^" + root_path + r"(?=/|$)", "", scope["path"]) -> '/products/all'
Is there a way we can use removeprefix instead?
removeprefix
Issue: https://github.com/encode/starlette/issues/2599 Discussion: https://github.com/encode/starlette/discussions/2495
Summary
Change regex used to remove root_path to consider only the root path without match simillar endpoint that contains the root_path as substring. ex:
before:
after:
Checklist