aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/base_route.py
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-02-11 17:09:58 +0000
committerGravatar GitHub <[email protected]>2018-02-11 17:09:58 +0000
commit64b1108081b6ee9e89acd104454e7a117e28a061 (patch)
tree53ec4f1552ec5d99eaabc9eb46a91a6c74c08343 /pysite/base_route.py
parentAPIView should inherit RouteView (diff)
Asana integration (#7)
* Event dispatching and webhook sending * snekchek
Diffstat (limited to 'pysite/base_route.py')
-rw-r--r--pysite/base_route.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py
index 04694186..a3e8615b 100644
--- a/pysite/base_route.py
+++ b/pysite/base_route.py
@@ -33,10 +33,18 @@ class APIView(RouteView):
"error_message": "Unknown error"
}
+ http_code = 200
+
if error_code is ErrorCodes.unknown_route:
data["error_message"] = "Unknown API route"
-
- return jsonify(data)
+ http_code = 404
+ elif error_code is ErrorCodes.unauthorized:
+ data["error_message"] = "Unauthorized"
+ http_code = 403
+
+ response = jsonify(data)
+ response.status_code = http_code
+ return response
class ErrorView(BaseView):