mirror of https://github.com/django/django.git
Refs #33546 -- Avoided unpacking data in ResponseHeaders when not necessary.
This commit is contained in:
parent
9bde906fb2
commit
e0b197c63c
|
@ -33,6 +33,7 @@ class ResponseHeaders(CaseInsensitiveMapping):
|
||||||
correctly encoded.
|
correctly encoded.
|
||||||
"""
|
"""
|
||||||
self._store = {}
|
self._store = {}
|
||||||
|
if data:
|
||||||
for header, value in self._unpack_items(data):
|
for header, value in self._unpack_items(data):
|
||||||
self[header] = value
|
self[header] = value
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ class HttpResponseBase:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, content_type=None, status=None, reason=None, charset=None, headers=None
|
self, content_type=None, status=None, reason=None, charset=None, headers=None
|
||||||
):
|
):
|
||||||
self.headers = ResponseHeaders(headers or {})
|
self.headers = ResponseHeaders(headers)
|
||||||
self._charset = charset
|
self._charset = charset
|
||||||
if content_type and "Content-Type" in self.headers:
|
if content_type and "Content-Type" in self.headers:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|
Loading…
Reference in New Issue