Moves http_method_names out to shared scope.

This commit is contained in:
Billy Ferguson 2019-10-10 15:18:46 -04:00 committed by GitHub
parent 65017c73d9
commit 3034d0a919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,9 +133,9 @@ class EndpointEnumerator:
"""
Return a list of the valid HTTP methods for this endpoint.
"""
http_method_names = set(callback.cls.http_method_names)
if hasattr(callback, 'actions'):
actions = set(callback.actions)
http_method_names = set(callback.cls.http_method_names)
methods = [method.upper() for method in actions & http_method_names]
else:
methods = [method.upper() for method in callback.cls().allowed_methods & http_method_names]