mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-20 08:55:24 -04:00
📝 Update Request Body's tutorial002 to deal with tax=0 case (#13230)
Co-authored-by: svlandeg <svlandeg@github.com>
This commit is contained in:
1 parent
0541693bc7
commit
9667ce87a9
2 files changed
+2
-2
No files matched your search
@@ -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
|
||||
@@ -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
|
||||
Reference in new issue
Block a user