diff --git a/channels/handler.py b/channels/handler.py index c8a058e..43fd653 100644 --- a/channels/handler.py +++ b/channels/handler.py @@ -87,14 +87,16 @@ class AsgiRequest(http.HttpRequest): self.META[corrected_name] = value # Pull out request encoding if we find it if "CONTENT_TYPE" in self.META: - _, content_params = cgi.parse_header(self.META["CONTENT_TYPE"]) - if 'charset' in content_params: + self.content_type, self.content_params = cgi.parse_header(self.META["CONTENT_TYPE"]) + if 'charset' in self.content_params: try: - codecs.lookup(content_params['charset']) + codecs.lookup(self.content_params['charset']) except LookupError: pass else: - self.encoding = content_params['charset'] + self.encoding = self.content_params['charset'] + else: + self.content_type, self.content_params = "", {} # Pull out content length info if self.META.get('CONTENT_LENGTH', None): try: diff --git a/patchinator.py b/patchinator.py index f86e07c..9c5eb34 100644 --- a/patchinator.py +++ b/patchinator.py @@ -124,6 +124,7 @@ global_transforms = [ Replacement(r"from django.channels.tests import", r"from django.test.channels import"), Replacement(r"from django.channels.handler import", r"from django.core.handlers.asgi import"), Replacement(r"channels.tests.test_routing", r"channels_tests.test_routing"), + Replacement(r"django.core.urlresolvers", r"django.urls"), ] python_transforms = global_transforms + [