Fix exception with endpoints returning HTTP status code 204. Fixes #1891

This commit is contained in:
grossmj
2021-08-10 21:53:21 +09:30
parent 36b9f8bdfd
commit ce55ec73a4
29 changed files with 337 additions and 192 deletions

View File

@ -18,7 +18,7 @@
API routes for drawings.
"""
from fastapi import APIRouter, status
from fastapi import APIRouter, Response, status
from fastapi.encoders import jsonable_encoder
from typing import List
from uuid import UUID
@ -76,10 +76,11 @@ async def update_drawing(project_id: UUID, drawing_id: UUID, drawing_data: schem
@router.delete("/{drawing_id}", status_code=status.HTTP_204_NO_CONTENT)
async def delete_drawing(project_id: UUID, drawing_id: UUID) -> None:
async def delete_drawing(project_id: UUID, drawing_id: UUID) -> Response:
"""
Delete a drawing.
"""
project = await Controller.instance().get_loaded_project(str(project_id))
await project.delete_drawing(str(drawing_id))
return Response(status_code=status.HTTP_204_NO_CONTENT)