|
|
@ -14,6 +14,11 @@ class Item(BaseModel): |
|
|
|
price: Optional[float] = None |
|
|
|
|
|
|
|
|
|
|
|
@app.head("/items/{item_id}") |
|
|
|
def head_item(item_id: str): |
|
|
|
return JSONResponse(None, headers={"x-fastapi-item-id": item_id}) |
|
|
|
|
|
|
|
|
|
|
|
@app.api_route("/items/{item_id}", methods=["GET"]) |
|
|
|
def get_items(item_id: str): |
|
|
|
return {"item_id": item_id} |
|
|
@ -31,11 +36,6 @@ def delete_item(item_id: str, item: Item): |
|
|
|
return {"item_id": item_id, "item": item} |
|
|
|
|
|
|
|
|
|
|
|
@app.head("/items/{item_id}") |
|
|
|
def head_item(item_id: str): |
|
|
|
return JSONResponse(None, headers={"x-fastapi-item-id": item_id}) |
|
|
|
|
|
|
|
|
|
|
|
@app.options("/items/{item_id}") |
|
|
|
def options_item(item_id: str): |
|
|
|
return JSONResponse(None, headers={"x-fastapi-item-id": item_id}) |
|
|
|