From 4f79f6c29a1ab65b66be94077ceb9afa9d6433ea Mon Sep 17 00:00:00 2001 From: Automated Action Date: Fri, 16 May 2025 02:27:18 +0000 Subject: [PATCH] Fix HTTP 204 status code response handling - Remove return None from delete endpoints with 204 status code - HTTP status code 204 must not have a response body per HTTP spec - Fixed in both users.py and todos.py API endpoints - Addresses AssertionError: Status code 204 must not have a response body --- app/api/todos.py | 3 +-- app/api/users.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/api/todos.py b/app/api/todos.py index 54596af..77bd0b4 100644 --- a/app/api/todos.py +++ b/app/api/todos.py @@ -84,5 +84,4 @@ def delete_todo( """ success = todo_crud.delete_todo(db, todo_id=todo_id, owner_id=current_user.id) if not success: - raise HTTPException(status_code=404, detail="Todo not found") - return None \ No newline at end of file + raise HTTPException(status_code=404, detail="Todo not found") \ No newline at end of file diff --git a/app/api/users.py b/app/api/users.py index 0ad8b84..5cfed7f 100644 --- a/app/api/users.py +++ b/app/api/users.py @@ -74,7 +74,7 @@ def delete_user_endpoint( user_id: int, db: Session = Depends(get_db), current_user: User = Depends(get_current_active_user), -) -> Any: +): """ Delete a user. """ @@ -87,5 +87,4 @@ def delete_user_endpoint( success = delete_user(db, user_id=user_id) if not success: - raise HTTPException(status_code=404, detail="User not found") - return None \ No newline at end of file + raise HTTPException(status_code=404, detail="User not found") \ No newline at end of file