diff options
author | 2018-02-16 16:01:00 +0000 | |
---|---|---|
committer | 2018-02-16 16:01:00 +0000 | |
commit | 60694f47d02c37e3e54933a0b94cb202926c4b3d (patch) | |
tree | 586472ad302da134b1e4441056143a0934902fb3 /pysite/base_route.py | |
parent | API view for syncing users from the bot #yumr (#14) (diff) |
API schema validation decorator #yzuf (#15)
* API schema validation decorator
* Remove stray comma
* Remove unnecessary conditional
* Only cast to list when needed to
Diffstat (limited to 'pysite/base_route.py')
-rw-r--r-- | pysite/base_route.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py index 5c197a42..8e6648ee 100644 --- a/pysite/base_route.py +++ b/pysite/base_route.py @@ -112,8 +112,12 @@ class APIView(RouteView): elif error_code is ErrorCodes.invalid_api_key: data["error_message"] = "Invalid API-key" http_code = 401 - elif error_code is ErrorCodes.missing_parameters: - data["error_message"] = "Not all required parameters were provided" + elif error_code is ErrorCodes.bad_data_format: + data["error_message"] = "Input data in incorrect format" + http_code = 400 + elif error_code is ErrorCodes.incorrect_parameters: + data["error_message"] = "Incorrect parameters provided" + http_code = 400 response = jsonify(data) response.status_code = http_code |