INNER CODE UNIT · Python

create_item

hhstore/annotated-py-projects · fastapi/fastapi-0.103.1/docs_src/app_testing/app_b_py310/main.py:30

async def create_item(item: Item, x_token: str = Header()):
    if x_token != fake_secret_token:
        raise HTTPException(status_code=400, detail="Invalid X-Token header")
    if item.id in fake_db:
        raise HTTPException(status_code=400, detail="Item already exists")
    fake_db[item.id] = item
    return item

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…