Coverage for docs_src / query_params / tutorial003_py310.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1from fastapi import FastAPI 1ijklmnop
3app = FastAPI() 1ijklmnop
6@app.get("/items/{item_id}") 1ijklmnop
7async def read_item(item_id: str, q: str | None = None, short: bool = False): 1ijklmnop
8 item = {"item_id": item_id} 1aqebfcrgdsh
9 if q: 1aqebfcrgdsh
10 item.update({"q": q}) 1abcd
11 if not short: 1aqebfcrgdsh
12 item.update( 1aebfcgdh
13 {"description": "This is an amazing item that has a long description"}
14 )
15 return item 1aqebfcrgdsh