Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 1 of 1 for modify_response (0.06 seconds)

  1. tests/test_response_dependency.py

        """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("/")
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 05 18:23:16 GMT 2026
    - 5.2K bytes
    - Click Count (0)
Back to Top