MCPcopy Index your code
hub / github.com/fastapi/fastapi / delete_hero

Function delete_hero

docs_src/sql_databases/tutorial001_an_py310.py:67–73  ·  view source on GitHub ↗
(hero_id: int, session: SessionDep)

Source from the content-addressed store, hash-verified

65
66@app.delete("/heroes/{hero_id}")
67def delete_hero(hero_id: int, session: SessionDep):
68 hero = session.get(Hero, hero_id)
69 if not hero:
70 raise HTTPException(status_code=404, detail="Hero not found")
71 session.delete(hero)
72 session.commit()
73 return {"ok": True}

Callers

nothing calls this directly

Calls 3

HTTPExceptionClass · 0.90
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected