MCPcopy
hub / github.com/fastapi/fastapi / read_item

Function read_item

tests/test_starlette_exception.py:12–19  ·  view source on GitHub ↗
(item_id: str)

Source from the content-addressed store, hash-verified

10
11@app.get("/items/{item_id}")
12async def read_item(item_id: str):
13 if item_id not in items:
14 raise HTTPException(
15 status_code=404,
16 detail="Item not found",
17 headers={"X-Error": "Some custom header"},
18 )
19 return {"item": items[item_id]}
20
21
22@app.get("/http-no-body-statuscode-exception")

Callers

nothing calls this directly

Calls 1

HTTPExceptionClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…