MCPcopy
hub / github.com/fastapi/fastapi / middleware

Function middleware

tests/test_dependency_contextmanager.py:207–210  ·  view source on GitHub ↗
(request, call_next)

Source from the content-addressed store, hash-verified

205
206@app.middleware("http")
207async def middleware(request, call_next):
208 response: StreamingResponse = await call_next(request)
209 response.headers["x-state"] = json.dumps(state.copy())
210 return response
211
212
213client = TestClient(app)

Callers

nothing calls this directly

Calls 2

call_nextFunction · 0.85
dumpsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…