HEAD and OPTIONS should not be exposed as actions as discussed in a42afa04c3 (commitcomment-3241476)

This commit is contained in:
Nikolaus Schlemm 2013-05-18 17:38:47 +02:00
parent b225b1d5c9
commit 5ab7cc6e6b
2 changed files with 6 additions and 2 deletions

View File

@ -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):
'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': '',

View File

@ -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)