diff --git a/python/rest-api/rest_api.py b/python/rest-api/rest_api.py index 68e3407..d798626 100644 --- a/python/rest-api/rest_api.py +++ b/python/rest-api/rest_api.py @@ -53,6 +53,7 @@ class MethodRegistry: if payload: payload = json.loads(payload) + #It would be essential to validate JSON schema here f_result = f(f_self, payload) @@ -72,16 +73,9 @@ class RestAPI: def _process_request(self, method, url, payload): methods = self.registry.methods[method] - if url in methods.keys(): -# try: -# return methods[url](self, payload) -# except json.JSONDecodeError: -# return 'Bad request' -# finally: -# return 'Internal server error' -# else: -# return 'Not found' + #It would be natural to handle exceptions here + if url in methods.keys(): return methods[url](self, payload) def get(self, url, payload=None):