Skip to content

Commit

Permalink
Relax type of get_route_name argument to HttpConnection
Browse files Browse the repository at this point in the history
All information required is already provided by the HttpConnection class, which Request is a subclass of. Changing this to HttpConnection allows also passing a WebSocket instead
  • Loading branch information
pajowu committed Nov 20, 2023
1 parent b645ccb commit a9fc0c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prometheus_fastapi_instrumentator/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from typing import List, Optional

from starlette.requests import Request
from starlette.requests import HttpConnection
from starlette.routing import Match, Mount, Route
from starlette.types import Scope

Expand All @@ -66,7 +66,7 @@ def _get_route_name(
return None


def get_route_name(request: Request) -> Optional[str]:
def get_route_name(request: HttpConnection) -> Optional[str]:
"""Gets route name for given request taking mounts into account."""

app = request.app
Expand Down

0 comments on commit a9fc0c5

Please sign in to comment.