diff --git a/starlette/routing.py b/starlette/routing.py index 75a5ec3f3..481b13f5d 100644 --- a/starlette/routing.py +++ b/starlette/routing.py @@ -99,9 +99,7 @@ async def app(scope: Scope, receive: Receive, send: Send) -> None: def get_name(endpoint: typing.Callable[..., typing.Any]) -> str: - if inspect.isroutine(endpoint) or inspect.isclass(endpoint): - return endpoint.__name__ - return endpoint.__class__.__name__ + return getattr(endpoint, "__name__", endpoint.__class__.__name__) def replace_params(