From e684b27e465d920788e5b02bc4534a3ac50e7ef5 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 26 Apr 2016 13:33:26 +0100 Subject: [PATCH] Switch to uncode path and query string for HTTP --- channels/handler.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/channels/handler.py b/channels/handler.py index 56fd29d..c8a058e 100644 --- a/channels/handler.py +++ b/channels/handler.py @@ -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'):