Skip to content

Commit

Permalink
fix(prometheus): fix path template for routes without path parameters (
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammedbabelly20 authored Oct 19, 2024
1 parent a1b530c commit fd3ff42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion litestar/_asgi/routing_trie/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def parse_path_to_route(
try:
if path in plain_routes:
asgi_app, handler = parse_node_handlers(node=root_node.children[path], method=method)
return asgi_app, handler, path, {}, root_node.path_template
return asgi_app, handler, path, {}, path

if mount_paths_regex and (match := mount_paths_regex.match(path)):
mount_path = path[: match.end()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def clear_collectors() -> None:
@pytest.mark.parametrize(
"group_path, route_path, route_template, expected_path",
[
(True, "/test/litestar", "test/{name:str}", "/test/{name}"),
(True, "/test/litestar", "test/litestar", "/test/litestar"),
(False, "/test/litestar", "test/litestar", "/test/litestar"),
(True, "/test/litestar", "test/{name:str}", "/test/{name}"),
(False, "/test/litestar", "test/{name:str}", "/test/litestar"),
(
Expand Down

0 comments on commit fd3ff42

Please sign in to comment.