diff --git a/rest_framework/request.py b/rest_framework/request.py index f45a201f7..1cd919efd 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -385,8 +385,15 @@ class Request(object): # DRF uses multipart/form-data by default, which triggers an optimization # in the underlying django request. For more details: # https://github.com/django/django/blob/1.8.2/tests/requests/tests.py#L353-L372 - self._request.body - data = self._request.POST + if api_settings.FORM_OVERRIDE_DO_PARSE: + self._request.body + data = self._request.POST + else: + self._data = self._request.POST + self._files = self._request.FILES + self._full_data = self._data.copy() + self._full_data.update(self._files) + data = self._data # Method overloading - change the method and remove the param from the content. if ( diff --git a/rest_framework/settings.py b/rest_framework/settings.py index a3e9f5902..6541be267 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -92,6 +92,7 @@ DEFAULTS = { 'TEST_REQUEST_DEFAULT_FORMAT': 'multipart', # Browser enhancements + 'FORM_OVERRIDE_DO_PARSE': False, 'FORM_METHOD_OVERRIDE': '_method', 'FORM_CONTENT_OVERRIDE': '_content', 'FORM_CONTENTTYPE_OVERRIDE': '_content_type',