Island: Use HTTPStatus in `api/island/mode` resource

This commit is contained in:
Ilija Lazoroski 2022-08-01 14:07:09 +02:00
parent 1b562e723f
commit b69b0468c5
1 changed files with 3 additions and 6 deletions

View File

@ -26,14 +26,11 @@ class IslandMode(AbstractResource):
self._island_mode_service.set_mode(mode) 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 {}, HTTPStatus.NO_CONTENT
# return the response code?
# API Spec: This should be 204 (NO CONTENT)
return make_response({}, HTTPStatus.NO_CONTENT)
except (AttributeError, json.decoder.JSONDecodeError): except (AttributeError, json.decoder.JSONDecodeError):
return make_response({}, HTTPStatus.BAD_REQUEST) return {}, HTTPStatus.BAD_REQUEST
except ValueError: except ValueError:
return make_response({}, HTTPStatus.UNPROCESSABLE_ENTITY) return {}, HTTPStatus.UNPROCESSABLE_ENTITY
@jwt_required @jwt_required
def get(self): def get(self):