Skip to content

Commit 9667ce8

Browse files
togoghsvlandeg
andauthored
📝 Update Request Body's tutorial002 to deal with tax=0 case (#13230)
Co-authored-by: svlandeg <[email protected]>
1 parent 0541693 commit 9667ce8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

docs_src/body/tutorial002.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Item(BaseModel):
1717
@app.post("/items/")
1818
async def create_item(item: Item):
1919
item_dict = item.dict()
20-
if item.tax:
20+
if item.tax is not None:
2121
price_with_tax = item.price + item.tax
2222
item_dict.update({"price_with_tax": price_with_tax})
2323
return item_dict

docs_src/body/tutorial002_py310.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Item(BaseModel):
1515
@app.post("/items/")
1616
async def create_item(item: Item):
1717
item_dict = item.dict()
18-
if item.tax:
18+
if item.tax is not None:
1919
price_with_tax = item.price + item.tax
2020
item_dict.update({"price_with_tax": price_with_tax})
2121
return item_dict

0 commit comments

Comments
 (0)