📝 Update Request Body's tutorial002 to deal with tax=0 case (#13230)

Co-authored-by: svlandeg <svlandeg@github.com>
This commit is contained in:
Ysabelandsvlandeg authored and GitHub committed 2025-01-30 12:19:10 +00:00
1 parent 0541693bc7
commit 9667ce87a9
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
item_dict = item.dict()
if item.tax:
if item.tax is not None:
price_with_tax = item.price + item.tax
item_dict.update({"price_with_tax": price_with_tax})
return item_dict
+1 -1
View File
@@ -15,7 +15,7 @@ app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
item_dict = item.dict()
if item.tax:
if item.tax is not None:
price_with_tax = item.price + item.tax
item_dict.update({"price_with_tax": price_with_tax})
return item_dict