INNER CODE UNIT · Python

__call__

stephenhillier/starlette_exporter · starlette_exporter/middleware.py:367

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        if scope["type"] not in ["http"]:
            await self.app(scope, receive, send)
            return

        request = Request(scope, receive)

        method = request.method
        path = request.url.path
        base_path = request.base_url.path.rstrip("/")

        if base_path and path.startswith(base_path):
            path = path[len(base_path) :]

        if any(pattern.fullmatch(path) for pattern in self.skip_paths) or method in self.skip_methods:
            await self.app(scope, receive, send)
            return

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…