From 4666aae90c176cccaf0dc4bcbf2b51ddd9e1cdc7 Mon Sep 17 00:00:00 2001 From: Billy Ferguson Date: Thu, 10 Oct 2019 15:23:31 -0400 Subject: [PATCH] Cast allowed_methods to set for set diff. --- rest_framework/schemas/generators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index 00d33a89a..ef663b3ff 100644 --- a/rest_framework/schemas/generators.py +++ b/rest_framework/schemas/generators.py @@ -138,7 +138,8 @@ class EndpointEnumerator: actions = set(callback.actions) methods = [method.upper() for method in actions & http_method_names] else: - methods = [method.upper() for method in callback.cls().allowed_methods & http_method_names] + allowed_methods = set(callback.cls().allowed_methods) + methods = [method.upper() for method in allowed_methods & http_method_names] return [method for method in methods if method not in ('OPTIONS', 'HEAD')]