FastAPI - Middleware and Hooks
Examine this middleware code snippet and identify the issue:
class TimingMiddleware(BaseHTTPMiddleware):
def dispatch(self, request, call_next):
start = time.time()
response = await call_next(request)
process_time = time.time() - start
response.headers['X-Process-Time'] = str(process_time)
return response