diff options
| author | Nikolaus Schlemm | 2013-05-18 17:38:47 +0200 |
|---|---|---|
| committer | Nikolaus Schlemm | 2013-05-18 17:38:47 +0200 |
| commit | 5ab7cc6e6be5445bc0d4ccc26f1ec84239af74d5 (patch) | |
| tree | 8bc69d4c37753add90aa1beba8be3227632eb1d1 | |
| parent | b225b1d5c9cd8e2bec289f5da795637385b2cbe6 (diff) | |
| download | django-rest-framework-5ab7cc6e6be5445bc0d4ccc26f1ec84239af74d5.tar.bz2 | |
HEAD and OPTIONS should not be exposed as actions as discussed in https://github.com/nschlemm/django-rest-framework/commit/a42afa04c38afe25c9032b8ce37b572678b02cf1#commitcomment-3241476
| -rw-r--r-- | rest_framework/tests/generics.py | 4 | ||||
| -rw-r--r-- | rest_framework/views.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/rest_framework/tests/generics.py b/rest_framework/tests/generics.py index 014195ae..d8556638 100644 --- a/rest_framework/tests/generics.py +++ b/rest_framework/tests/generics.py @@ -125,7 +125,7 @@ class TestRootView(TestCase): 'actions': {} } # 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] = { 'text': { 'description': '', @@ -261,7 +261,7 @@ class TestInstanceView(TestCase): 'actions': {} } # 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] = { 'text': { 'description': '', diff --git a/rest_framework/views.py b/rest_framework/views.py index 719df428..c5b89a02 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -71,6 +71,10 @@ class APIView(View): actions = {} for method in self.allowed_methods: + # skip HEAD and OPTIONS + if method in ('HEAD', 'OPTIONS'): + continue + cloned_request = clone_request(request, method) try: self.check_permissions(cloned_request) |
