From 992c60e3e026149c35e4464316f9a0233b943ded Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 11 Nov 2019 15:32:57 +0800 Subject: [PATCH] Return HTTP status code 204 in API when project successfully closed. Fixes #1689 --- gns3server/handlers/api/controller/project_handler.py | 3 +-- tests/handlers/api/controller/test_project.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/handlers/api/controller/project_handler.py b/gns3server/handlers/api/controller/project_handler.py index 50a82440..066e2781 100644 --- a/gns3server/handlers/api/controller/project_handler.py +++ b/gns3server/handlers/api/controller/project_handler.py @@ -166,8 +166,7 @@ class ProjectHandler: controller = Controller.instance() project = controller.get_project(request.match_info["project_id"]) await project.close() - response.set_status(201) - response.json(project) + response.set_status(204) @Route.post( r"/projects/{project_id}/open", diff --git a/tests/handlers/api/controller/test_project.py b/tests/handlers/api/controller/test_project.py index 6245558c..1b75aab7 100644 --- a/tests/handlers/api/controller/test_project.py +++ b/tests/handlers/api/controller/test_project.py @@ -148,7 +148,7 @@ def test_delete_project_invalid_uuid(http_controller): def test_close_project(http_controller, project): with asyncio_patch("gns3server.controller.project.Project.close", return_value=True) as mock: response = http_controller.post("/projects/{project_id}/close".format(project_id=project.id), example=True) - assert response.status == 201 + assert response.status == 204 assert mock.called