Commit 47f5bd48 by Tom Christie

Merge pull request #1361 from ross/x_method_override

always obey X-HTTP-METHOD-OVERRIDE header
parents 92fe7560 58d77c11
...@@ -279,10 +279,9 @@ class Request(object): ...@@ -279,10 +279,9 @@ class Request(object):
if not _hasattr(self, '_method'): if not _hasattr(self, '_method'):
self._method = self._request.method self._method = self._request.method
if self._method == 'POST': # Allow X-HTTP-METHOD-OVERRIDE header
# Allow X-HTTP-METHOD-OVERRIDE header self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE',
self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE', self._method)
self._method)
def _load_stream(self): def _load_stream(self):
""" """
......
...@@ -68,6 +68,9 @@ class TestMethodOverloading(TestCase): ...@@ -68,6 +68,9 @@ class TestMethodOverloading(TestCase):
request = Request(factory.post('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE')) request = Request(factory.post('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
self.assertEqual(request.method, '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): class TestContentParsing(TestCase):
def test_standard_behaviour_determines_no_content_GET(self): def test_standard_behaviour_determines_no_content_GET(self):
......
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