summaryrefslogtreecommitdiff
path: root/django/http/request.py
diff options
context:
space:
mode:
authorMehrdad <mhrddmoradii@gmail.com>2022-06-27 10:28:48 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-06-28 07:33:41 +0200
commitd6e0c7c30c1eb83f49345181dc63723968f297ae (patch)
tree6e97f709901fb8d5f8741e6ace7e19c1dca61505 /django/http/request.py
parenteb7b8f3699fbe5ad6aaafb264355741648fdd5e4 (diff)
Refs #33697 -- Made MediaType use django.utils.http.parse_header_parameters().
Diffstat (limited to 'django/http/request.py')
-rw-r--r--django/http/request.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/django/http/request.py b/django/http/request.py
index ad4ec0f331..d65adce756 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -24,8 +24,6 @@ from django.utils.functional import cached_property
from django.utils.http import is_same_domain, parse_header_parameters
from django.utils.regex_helper import _lazy_re_compile
-from .multipartparser import parse_header
-
RAISE_ERROR = object()
host_validation_re = _lazy_re_compile(
r"^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9\.:]+\])(:[0-9]+)?$"
@@ -620,15 +618,13 @@ class QueryDict(MultiValueDict):
class MediaType:
def __init__(self, media_type_raw_line):
- full_type, self.params = parse_header(
- media_type_raw_line.encode("ascii") if media_type_raw_line else b""
+ full_type, self.params = parse_header_parameters(
+ media_type_raw_line if media_type_raw_line else ""
)
self.main_type, _, self.sub_type = full_type.partition("/")
def __str__(self):
- params_str = "".join(
- "; %s=%s" % (k, v.decode("ascii")) for k, v in self.params.items()
- )
+ params_str = "".join("; %s=%s" % (k, v) for k, v in self.params.items())
return "%s%s%s" % (
self.main_type,
("/%s" % self.sub_type) if self.sub_type else "",