From 17539e648458f1b8de7637e7de760161b38d7b72 Mon Sep 17 00:00:00 2001 From: Brad Solomon Date: Sat, 31 Jul 2021 17:45:27 -0400 Subject: [PATCH] Ensure request method is compare to http_method_names of same case Make sure both LHS and RHS are lower-cased in comparison for membership testing. Closes #8106 --- rest_framework/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/views.py b/rest_framework/views.py index 5b0622069..071d52283 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -497,7 +497,7 @@ class APIView(View): self.initial(request, *args, **kwargs) # Get the appropriate handler method - if request.method.lower() in self.http_method_names: + if request.method.lower() in map(str.lower, self.http_method_names): handler = getattr(self, request.method.lower(), self.http_method_not_allowed) else: