MCPcopy
hub / github.com/fastapi/fastapi / add_process_time_header

Function add_process_time_header

docs_src/middleware/tutorial001_py310.py:9–14  ·  view source on GitHub ↗
(request: Request, call_next)

Source from the content-addressed store, hash-verified

7
8@app.middleware("http")
9async def add_process_time_header(request: Request, call_next):
10 start_time = time.perf_counter()
11 response = await call_next(request)
12 process_time = time.perf_counter() - start_time
13 response.headers["X-Process-Time"] = str(process_time)
14 return response

Callers

nothing calls this directly

Calls 1

call_nextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…