Island: Use HTTPStatus Enum in registration resource

This commit is contained in:
Mike Salvatore 2022-07-12 09:55:33 -04:00
parent 6f2a750a13
commit a20a7710aa
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import logging
from http import HTTPStatus
from flask import make_response, request
@ -25,7 +26,7 @@ class Registration(AbstractResource):
try:
self._authentication_service.register_new_user(username, password)
return make_response({"error": ""}, 200)
return make_response({"error": ""}, HTTPStatus.OK)
# API Spec: HTTP status code for AlreadyRegisteredError should be 409 (CONFLICT)
except (InvalidRegistrationCredentialsError, AlreadyRegisteredError) as e:
return make_response({"error": str(e)}, 400)
return make_response({"error": str(e)}, HTTPStatus.BAD_REQUEST)