Skip to content

Commit

Permalink
Do not fail with 500 error when unknown HTTP verb is sent
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Jul 23, 2024
1 parent 6e29dc8 commit 2389e85
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dispatcher/backend/src/routes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2389e85

Please sign in to comment.