Commit 4a6490a4 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Removed HttpRequest.raw_post_data.

parent d1c72d9e
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -187,11 +187,6 @@ class HttpRequest(object):
            self._stream = BytesIO(self._body)
        return self._body

    @property
    def raw_post_data(self):
        warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', DeprecationWarning)
        return self.body

    def _mark_post_parse_error(self):
        self._post = QueryDict('')
        self._files = MultiValueDict()
+0 −5
Original line number Diff line number Diff line
@@ -34,11 +34,6 @@ All attributes should be considered read-only, unless stated otherwise below.

.. attribute:: HttpRequest.body

    .. versionchanged:: 1.4

    Before Django 1.4, ``HttpRequest.body`` was named
    ``HttpRequest.raw_post_data``.

    The raw HTTP request body as a byte string. This is useful for processing
    data in different ways than conventional HTML forms: binary images,
    XML payload etc. For processing conventional form data, use ``HttpRequest.POST``.
+2 −19
Original line number Diff line number Diff line
@@ -507,20 +507,6 @@ class RequestsTests(unittest.TestCase):
        self.assertEqual(request.read(13), b'--boundary\r\nC')
        self.assertEqual(request.POST, {'name': ['value']})

    def test_raw_post_data_returns_body(self):
        """
        HttpRequest.raw_post_body should be the same as HttpRequest.body
        """
        payload = FakePayload('Hello There!')
        request = WSGIRequest({
            'REQUEST_METHOD': 'POST',
            'CONTENT_LENGTH': len(payload),
            'wsgi.input': payload,
        })

        with warnings.catch_warnings(record=True):
            self.assertEqual(request.body, request.raw_post_data)

    def test_POST_connection_error(self):
        """
        If wsgi.input.read() raises an exception while trying to read() the
@@ -536,8 +522,5 @@ class RequestsTests(unittest.TestCase):
                               'CONTENT_LENGTH': len(payload),
                               'wsgi.input': ExplodingBytesIO(payload)})

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
        with self.assertRaises(UnreadablePostError):
                request.raw_post_data
            self.assertEqual(len(w), 1)
            request.body