Remove explicit Response for endpoints returning HTTP 204 status code

This commit is contained in:
grossmj
2022-07-16 00:12:18 +02:00
parent 5b478fc331
commit fc6aeb715a
29 changed files with 162 additions and 302 deletions

View File

@ -136,14 +136,13 @@ async def update_link(link_data: schemas.LinkUpdate, link: Link = Depends(dep_li
@router.delete("/{link_id}", status_code=status.HTTP_204_NO_CONTENT)
async def delete_link(project_id: UUID, link: Link = Depends(dep_link)) -> Response:
async def delete_link(project_id: UUID, link: Link = Depends(dep_link)) -> None:
"""
Delete a link.
"""
project = await Controller.instance().get_loaded_project(str(project_id))
await project.delete_link(link.id)
return Response(status_code=status.HTTP_204_NO_CONTENT)
@router.post("/{link_id}/reset", response_model=schemas.Link)
@ -170,13 +169,12 @@ async def start_capture(capture_data: dict, link: Link = Depends(dep_link)) -> s
@router.post("/{link_id}/capture/stop", status_code=status.HTTP_204_NO_CONTENT)
async def stop_capture(link: Link = Depends(dep_link)) -> Response:
async def stop_capture(link: Link = Depends(dep_link)) -> None:
"""
Stop packet capture on the link.
"""
await link.stop_capture()
return Response(status_code=status.HTTP_204_NO_CONTENT)
@router.get("/{link_id}/capture/stream")