Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for read_item_header (0.07 sec)

  1. docs_src/handling_errors/tutorial002_py39.py

    from fastapi import FastAPI, HTTPException
    
    app = FastAPI()
    
    items = {"foo": "The Foo Wrestlers"}
    
    
    @app.get("/items-header/{item_id}")
    async def read_item_header(item_id: str):
        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "There goes my error"},
            )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 404 bytes
    - Viewed (0)
Back to top