Skip to content

Commit

Permalink
Merge pull request #1001 from openzim/unknown_http_method
Browse files Browse the repository at this point in the history
Do not fail with 500 error when unknown HTTP verb is sent
  • Loading branch information
benoit74 authored Jul 23, 2024
2 parents 6e29dc8 + 2389e85 commit ebe4912
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 ebe4912

Please sign in to comment.