Ensure form overloading performs parsing.

This commit is contained in:
Ryan P Kilby 2015-05-26 22:59:45 -04:00
parent 010f2ee9bd
commit 583686cd06

View File

@ -380,29 +380,27 @@ class Request(object):
): ):
return return
# At this point we're committed to parsing the request as form data. # Reading the request body before directly accessing the POST attr will
self._data = self._request.POST # ensure the request body is stored, making it accessible again later.
self._files = self._request.FILES self._request.body
self._full_data = self._data.copy() data = self._request.POST
self._full_data.update(self._files)
# 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 (
self._METHOD_PARAM and self._METHOD_PARAM and
self._METHOD_PARAM in self._data self._METHOD_PARAM in data
): ):
self._method = self._data[self._METHOD_PARAM].upper() self._method = data[self._METHOD_PARAM].upper()
# Content overloading - modify the content type, and force re-parse. # Content overloading - modify the content type, and force re-parse.
if ( if (
self._CONTENT_PARAM and self._CONTENT_PARAM and
self._CONTENTTYPE_PARAM and self._CONTENTTYPE_PARAM and
self._CONTENT_PARAM in self._data and self._CONTENT_PARAM in data and
self._CONTENTTYPE_PARAM in self._data self._CONTENTTYPE_PARAM in data
): ):
self._content_type = self._data[self._CONTENTTYPE_PARAM] self._content_type = data[self._CONTENTTYPE_PARAM]
self._stream = six.BytesIO(self._data[self._CONTENT_PARAM].encode(self.parser_context['encoding'])) self._stream = six.BytesIO(data[self._CONTENT_PARAM].encode(self.parser_context['encoding']))
self._data, self._files, self._full_data = (Empty, Empty, Empty)
def _parse(self): def _parse(self):
""" """