mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
always obey X-HTTP-METHOD-OVERRIDE header
required to support old flash/flex clients that need to do everything as GET requests (apparently to allow for any error handlings)
This commit is contained in:
parent
f92d8bd972
commit
58d77c11c3
|
@ -279,10 +279,9 @@ class Request(object):
|
|||
if not _hasattr(self, '_method'):
|
||||
self._method = self._request.method
|
||||
|
||||
if self._method == 'POST':
|
||||
# Allow X-HTTP-METHOD-OVERRIDE header
|
||||
self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE',
|
||||
self._method)
|
||||
# Allow X-HTTP-METHOD-OVERRIDE header
|
||||
self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE',
|
||||
self._method)
|
||||
|
||||
def _load_stream(self):
|
||||
"""
|
||||
|
|
|
@ -66,6 +66,9 @@ class TestMethodOverloading(TestCase):
|
|||
request = Request(factory.post('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
|
||||
self.assertEqual(request.method, 'DELETE')
|
||||
|
||||
request = Request(factory.get('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
|
||||
self.assertEqual(request.method, 'DELETE')
|
||||
|
||||
|
||||
class TestContentParsing(TestCase):
|
||||
def test_standard_behaviour_determines_no_content_GET(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user