Switch to uncode path and query string for HTTP

This commit is contained in:
Andrew Godwin 2016-04-26 13:33:26 +01:00
parent 7945859bb2
commit e684b27e46

View File

@ -41,8 +41,8 @@ class AsgiRequest(http.HttpRequest):
self._post_parse_error = False
self.resolver_match = None
# Path info
self.path = self.message['path'].decode("ascii")
self.script_name = self.message.get('root_path', b'')
self.path = self.message['path']
self.script_name = self.message.get('root_path', '')
if self.script_name:
# TODO: Better is-prefix checking, slash handling?
self.path_info = self.path[len(self.script_name):]
@ -52,8 +52,8 @@ class AsgiRequest(http.HttpRequest):
self.method = self.message['method'].upper()
self.META = {
"REQUEST_METHOD": self.method,
"QUERY_STRING": self.message.get('query_string', b'').decode("ascii"),
"SCRIPT_NAME": self.script_name.decode("ascii"),
"QUERY_STRING": self.message.get('query_string', ''),
"SCRIPT_NAME": self.script_name,
# Old code will need these for a while
"wsgi.multithread": True,
"wsgi.multiprocess": True,
@ -133,10 +133,7 @@ class AsgiRequest(http.HttpRequest):
@cached_property
def GET(self):
return http.QueryDict(
self.message.get('query_string', ''),
encoding=self._encoding,
)
return http.QueryDict(self.message.get('query_string', '').encode("utf8"))
def _get_post(self):
if not hasattr(self, '_post'):