Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Ensure profiling middleware is compatible with fastapi #6760

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any, Final

from fastapi import FastAPI
from servicelib.aiohttp import status
from servicelib.mimetype_constants import MIMETYPE_APPLICATION_JSON
from starlette.requests import Request
from starlette.types import ASGIApp, Receive, Scope, Send

from ..utils_profiling_middleware import (
_is_profiling,
Expand Down Expand Up @@ -31,11 +31,11 @@ class ProfilerMiddleware:
https://fastapi.tiangolo.com/advanced/middleware/#advanced-middleware
"""

def __init__(self, app: FastAPI):
self._app: FastAPI = app
def __init__(self, app: ASGIApp):
self._app = app
self._profile_header_trigger: Final[str] = "x-profile"

async def __call__(self, scope, receive, send):
async def __call__(self, scope: Scope, receive: Receive, send: Send):
if scope["type"] != "http":
await self._app(scope, receive, send)
return
Expand Down
Loading