Commit 5ab7cc6e by Nikolaus Schlemm

HEAD and OPTIONS should not be exposed as actions as discussed in…

HEAD and OPTIONS should not be exposed as actions as discussed in https://github.com/nschlemm/django-rest-framework/commit/a42afa04c38afe25c9032b8ce37b572678b02cf1#commitcomment-3241476
parent b225b1d5
...@@ -125,7 +125,7 @@ class TestRootView(TestCase): ...@@ -125,7 +125,7 @@ class TestRootView(TestCase):
'actions': {} 'actions': {}
} }
# TODO: this is just a draft for fields' metadata - needs review and decision # TODO: this is just a draft for fields' metadata - needs review and decision
for method in ('HEAD', 'GET', 'POST', 'OPTIONS'): for method in ('GET', 'POST',):
expected['actions'][method] = { expected['actions'][method] = {
'text': { 'text': {
'description': '', 'description': '',
...@@ -261,7 +261,7 @@ class TestInstanceView(TestCase): ...@@ -261,7 +261,7 @@ class TestInstanceView(TestCase):
'actions': {} 'actions': {}
} }
# TODO: this is just a draft idea for fields' metadata - needs review and decision # TODO: this is just a draft idea for fields' metadata - needs review and decision
for method in ('HEAD', 'GET', 'PATCH', 'PUT', 'OPTIONS', 'DELETE'): for method in ('GET', 'PATCH', 'PUT', 'DELETE'):
expected['actions'][method] = { expected['actions'][method] = {
'text': { 'text': {
'description': '', 'description': '',
......
...@@ -71,6 +71,10 @@ class APIView(View): ...@@ -71,6 +71,10 @@ class APIView(View):
actions = {} actions = {}
for method in self.allowed_methods: for method in self.allowed_methods:
# skip HEAD and OPTIONS
if method in ('HEAD', 'OPTIONS'):
continue
cloned_request = clone_request(request, method) cloned_request = clone_request(request, method)
try: try:
self.check_permissions(cloned_request) self.check_permissions(cloned_request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment