Skip to content

Commit

Permalink
🎨 Ensure profiling middleware is compatible with fastapi (#6760)
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis authored Nov 19, 2024
1 parent 3250e5d commit dcdc863
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit dcdc863

Please sign in to comment.