mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-26 03:36:14 -05:00
🚚 Re-sort tutorial example files
This commit is contained in:
@@ -10,6 +10,10 @@ class Item(BaseModel):
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item):
|
||||
return {"item_id": item_id, **item.dict()}
|
||||
@app.post("/items/")
|
||||
async def create_item(item: Item):
|
||||
item_dict = item.dict()
|
||||
if item.tax:
|
||||
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