mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
Added setting flag to use form parsing
This commit is contained in:
parent
fdc0711812
commit
290de9695a
|
@ -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 (
|
||||||
|
|
|
@ -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',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user