Home / Function/ test_response_with_depends_annotated() — fastapi Function Reference

test_response_with_depends_annotated() — fastapi Function Reference

Architecture documentation for the test_response_with_depends_annotated() function in test_response_dependency.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  d75674c9_ed3a_d929_31bf_66c03d54ad60["test_response_with_depends_annotated()"]
  b16d0181_b13b_77f6_4428_f731d5a25f66["test_response_dependency.py"]
  d75674c9_ed3a_d929_31bf_66c03d54ad60 -->|defined in| b16d0181_b13b_77f6_4428_f731d5a25f66
  style d75674c9_ed3a_d929_31bf_66c03d54ad60 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_response_dependency.py lines 14–31

def test_response_with_depends_annotated():
    """Response type hint should work with Annotated[Response, Depends(...)]."""
    app = FastAPI()

    def modify_response(response: Response) -> Response:
        response.headers["X-Custom"] = "modified"
        return response

    @app.get("/")
    def endpoint(response: Annotated[Response, Depends(modify_response)]):
        return {"status": "ok"}

    client = TestClient(app)
    resp = client.get("/")

    assert resp.status_code == 200
    assert resp.json() == {"status": "ok"}
    assert resp.headers.get("X-Custom") == "modified"

Domain

Subdomains

Frequently Asked Questions

What does test_response_with_depends_annotated() do?
test_response_with_depends_annotated() is a function in the fastapi codebase, defined in tests/test_response_dependency.py.
Where is test_response_with_depends_annotated() defined?
test_response_with_depends_annotated() is defined in tests/test_response_dependency.py at line 14.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free