From b69b0468c58d6aad2e17ab15e7b76f5e42db3f9c Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 1 Aug 2022 14:07:09 +0200 Subject: [PATCH] Island: Use HTTPStatus in `api/island/mode` resource --- monkey/monkey_island/cc/resources/island_mode.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island/cc/resources/island_mode.py b/monkey/monkey_island/cc/resources/island_mode.py index 2eb1ba627..5bd695b3d 100644 --- a/monkey/monkey_island/cc/resources/island_mode.py +++ b/monkey/monkey_island/cc/resources/island_mode.py @@ -26,14 +26,11 @@ class IslandMode(AbstractResource): self._island_mode_service.set_mode(mode) - # TODO: Do any of these returns need a body and make_response? What happens if we just - # return the response code? - # API Spec: This should be 204 (NO CONTENT) - return make_response({}, HTTPStatus.NO_CONTENT) + return {}, HTTPStatus.NO_CONTENT except (AttributeError, json.decoder.JSONDecodeError): - return make_response({}, HTTPStatus.BAD_REQUEST) + return {}, HTTPStatus.BAD_REQUEST except ValueError: - return make_response({}, HTTPStatus.UNPROCESSABLE_ENTITY) + return {}, HTTPStatus.UNPROCESSABLE_ENTITY @jwt_required def get(self):