Skip to content

Commit e473985

Browse files
authored
Merge pull request #28 from Juern-Univention/fix_naming_for_mounts
fix: 'Mount' object has no attribute 'endpoint'
2 parents 144accf + c1d8c5f commit e473985

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

timing_asgi/integrations/starlette.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from starlette.routing import Match
1+
from starlette.routing import Match, Route, Mount
22

33
from timing_asgi.interfaces import MetricNamer
44
from timing_asgi.utils import PathToName
@@ -27,7 +27,9 @@ def __call__(self, scope):
2727
if r.matches(scope)[0] == Match.FULL:
2828
route = r
2929
break
30-
if route is not None:
30+
if isinstance(route, Route):
3131
return f"{self.prefix}.{route.endpoint.__module__}.{route.name}"
32+
elif isinstance(route, Mount):
33+
return f"{self.prefix}.__mount__.{route.name}"
3234
else:
3335
return self.fallback(scope)

0 commit comments

Comments
 (0)