mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
HEAD and OPTIONS should not be exposed as actions as discussed in a42afa04c3 (commitcomment-3241476)
This commit is contained in:
parent
b225b1d5c9
commit
5ab7cc6e6b
|
@ -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': '',
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user