Island: Use HTTPStatus enum in new endpoints
This commit is contained in:
parent
774b2c0116
commit
fb1a3bcd74
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
from http import HTTPStatus
|
||||
|
||||
from flask import make_response, send_file
|
||||
|
||||
|
@ -34,7 +35,7 @@ class AgentBinaries(AbstractResource):
|
|||
except KeyError as err:
|
||||
error_msg = f'No Agents are available for unsupported operating system "{os}": {err}'
|
||||
logger.error(error_msg)
|
||||
return make_response({"error": error_msg}, 404)
|
||||
return make_response({"error": error_msg}, HTTPStatus.NOT_FOUND)
|
||||
except RetrievalError as err:
|
||||
logger.error(err)
|
||||
return make_response({"error": str(err)}, 500)
|
||||
return make_response({"error": str(err)}, HTTPStatus.INTERNAL_SERVER_ERROR)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from http import HTTPStatus
|
||||
|
||||
from flask import make_response
|
||||
|
||||
from monkey_island.cc.repository.i_credentials_repository import ICredentialsRepository
|
||||
|
@ -20,4 +22,4 @@ class ClearSimulationData(AbstractResource):
|
|||
Database.reset_db(reset_config=False)
|
||||
self._credentials_repository.remove_stolen_credentials()
|
||||
|
||||
return make_response({}, 200)
|
||||
return make_response({}, HTTPStatus.OK)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from http import HTTPStatus
|
||||
|
||||
from flask import make_response
|
||||
|
||||
from monkey_island.cc.repository import IAgentConfigurationRepository
|
||||
|
@ -18,4 +20,4 @@ class ResetAgentConfiguration(AbstractResource):
|
|||
"""
|
||||
self._agent_configuration_repository.reset_to_default()
|
||||
|
||||
return make_response({}, 200)
|
||||
return make_response({}, HTTPStatus.OK)
|
||||
|
|
Loading…
Reference in New Issue