Regular Response injection should still work.
()
| 52 | |
| 53 | |
| 54 | def 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 | |
| 71 | def test_response_dependency_chain(): |