diff --git a/dispatcher/backend/src/routes/base.py b/dispatcher/backend/src/routes/base.py index 86d4f549..e5964a84 100644 --- a/dispatcher/backend/src/routes/base.py +++ b/dispatcher/backend/src/routes/base.py @@ -16,9 +16,12 @@ def __call__(self, *args, **kwargs): "PATCH": self.patch, "DELETE": self.delete, } - handler = handlers[request.method] + handler = handlers.get(request.method, self.unknown) return handler(*args, **kwargs) + def unknown(self, *args, **kwargs): + return Response(status=HTTPStatus.METHOD_NOT_ALLOWED) + def get(self, *args, **kwargs): return Response(status=HTTPStatus.METHOD_NOT_ALLOWED)