Coverage for docs_src / handling_errors / tutorial001_py310.py: 100%
8 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from fastapi import FastAPI, HTTPException 1abcd
3app = FastAPI() 1abcd
5items = {"foo": "The Foo Wrestlers"} 1abcd
8@app.get("/items/{item_id}") 1abcd
9async def read_item(item_id: str): 1abcd
10 if item_id not in items: 1efghij
11 raise HTTPException(status_code=404, detail="Item not found") 1fhj
12 return {"item": items[item_id]} 1egi