MCPcopy
hub / github.com/fastapi/fastapi / test_response_without_depends

Function test_response_without_depends

tests/test_response_dependency.py:54–68  ·  view source on GitHub ↗

Regular Response injection should still work.

()

Source from the content-addressed store, hash-verified

52
53
54def test_response_without_depends():
55 """Regular Response injection should still work."""
56 app = FastAPI()
57
58 @app.get("/")
59 def endpoint(response: Response):
60 response.headers["X-Direct"] = "set"
61 return {"status": "ok"}
62
63 client = TestClient(app)
64 resp = client.get("/")
65
66 assert resp.status_code == 200
67 assert resp.json() == {"status": "ok"}
68 assert resp.headers.get("X-Direct") == "set"
69
70
71def test_response_dependency_chain():

Callers

nothing calls this directly

Calls 2

FastAPIClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…