backend/fastapi/app/middleware/middleware.py

10 lines
377 B
Python
Raw Permalink Normal View History

2024-12-06 05:12:28 +00:00
from fastapi import FastAPI, Request
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
from starlette.responses import Response
import time
class TimeHeaderMiddleware(BaseHTTPMiddleware) :
async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response:
return await super().dispatch(request, call_next)