summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
authorCurtis Maloney <curtis@tinbrain.net>2015-08-07 15:51:39 +1000
committerTim Graham <timograham@gmail.com>2016-02-10 18:19:23 -0500
commit6f1318734f0f3b6e62b782b0251a4e676e542e0b (patch)
treeb86024c484d214854b686233f77ac3a346db289f /django/http
parentdca8b916ffa391964be26bbd62471d4c11b221fd (diff)
Fixed #26014 -- Added WSGIRequest content_type and content_params attributes.
Parsed the CONTENT_TYPE header once and recorded it on the request.
Diffstat (limited to 'django/http')
-rw-r--r--django/http/request.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/http/request.py b/django/http/request.py
index d6ce49d755..2440b11758 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -61,6 +61,8 @@ class HttpRequest(object):
self.method = None
self.resolver_match = None
self._post_parse_error = False
+ self.content_type = None
+ self.content_params = None
def __repr__(self):
if self.method is None or not self.get_full_path():
@@ -278,7 +280,7 @@ class HttpRequest(object):
self._mark_post_parse_error()
return
- if self.META.get('CONTENT_TYPE', '').startswith('multipart/form-data'):
+ if self.content_type == 'multipart/form-data':
if hasattr(self, '_body'):
# Use already read data
data = BytesIO(self._body)
@@ -296,7 +298,7 @@ class HttpRequest(object):
# empty POST
self._mark_post_parse_error()
raise
- elif self.META.get('CONTENT_TYPE', '').startswith('application/x-www-form-urlencoded'):
+ elif self.content_type == 'application/x-www-form-urlencoded':
self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict()
else:
self._post, self._files = QueryDict('', encoding=self._encoding), MultiValueDict()