Added setting flag to use form parsing

This commit is contained in:
Ryan P Kilby 2015-05-29 21:43:00 -04:00
parent fdc0711812
commit 290de9695a
2 changed files with 10 additions and 2 deletions

View File

@ -385,8 +385,15 @@ class Request(object):
# DRF uses multipart/form-data by default, which triggers an optimization # DRF uses multipart/form-data by default, which triggers an optimization
# in the underlying django request. For more details: # in the underlying django request. For more details:
# https://github.com/django/django/blob/1.8.2/tests/requests/tests.py#L353-L372 # https://github.com/django/django/blob/1.8.2/tests/requests/tests.py#L353-L372
self._request.body if api_settings.FORM_OVERRIDE_DO_PARSE:
data = self._request.POST 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. # Method overloading - change the method and remove the param from the content.
if ( if (

View File

@ -92,6 +92,7 @@ DEFAULTS = {
'TEST_REQUEST_DEFAULT_FORMAT': 'multipart', 'TEST_REQUEST_DEFAULT_FORMAT': 'multipart',
# Browser enhancements # Browser enhancements
'FORM_OVERRIDE_DO_PARSE': False,
'FORM_METHOD_OVERRIDE': '_method', 'FORM_METHOD_OVERRIDE': '_method',
'FORM_CONTENT_OVERRIDE': '_content', 'FORM_CONTENT_OVERRIDE': '_content',
'FORM_CONTENTTYPE_OVERRIDE': '_content_type', 'FORM_CONTENTTYPE_OVERRIDE': '_content_type',