forked from p15670423/monkey
Island: Use HTTPStatus Enum in PBA FileUpload resource
This commit is contained in:
parent
0d45c5fb3e
commit
9c7bf6c8b5
|
@ -70,7 +70,7 @@ class FileUpload(AbstractResource):
|
||||||
return send_file(file, mimetype="application/octet-stream")
|
return send_file(file, mimetype="application/octet-stream")
|
||||||
except repository.FileNotFoundError as err:
|
except repository.FileNotFoundError as err:
|
||||||
logger.error(str(err))
|
logger.error(str(err))
|
||||||
return make_response({"error": str(err)}, 404)
|
return make_response({"error": str(err)}, HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
# NOTE: Consider putting most of this functionality into a service when this is transformed into
|
# NOTE: Consider putting most of this functionality into a service when this is transformed into
|
||||||
# a payload plugin.
|
# a payload plugin.
|
||||||
|
@ -96,7 +96,7 @@ class FileUpload(AbstractResource):
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
# API Spec: HTTP status code should be 201
|
# API Spec: HTTP status code should be 201
|
||||||
response = Response(response=safe_filename, status=200, mimetype="text/plain")
|
response = Response(response=safe_filename, status=HTTPStatus.OK, mimetype="text/plain")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def _update_config(self, target_os: str, safe_filename: str):
|
def _update_config(self, target_os: str, safe_filename: str):
|
||||||
|
@ -136,7 +136,7 @@ class FileUpload(AbstractResource):
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
# API Spec: HTTP status code should be 204
|
# API Spec: HTTP status code should be 204
|
||||||
return make_response({}, 200)
|
return make_response({}, HTTPStatus.OK)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _is_target_os_supported(target_os: str) -> bool:
|
def _is_target_os_supported(target_os: str) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue