DELETE 204 no body

Sarit Ritwirune
May 21, 2024

--

@app.delete('/{task_id}', description="Delete task", status_code=status.HTTP_204_NO_CONTENT)
async def _delete_task(task_id: CurrentTaskContent = Depends(valid_task)) -> None:
"""Endpoint to delete a task."""
delete_task(task_id)
return

FastAPI will look like this. Remember DELETE status code 204 has no body.

--

--

Sarit Ritwirune
Sarit Ritwirune

Written by Sarit Ritwirune

On the way to full stack cross-platform. Currently make living by data science.