Content-type fixes.

This commit is contained in:
L. Kärkkäinen 2019-09-10 14:58:22 +03:00
parent fff519fae4
commit 1acd1d7d88

View File

@ -51,7 +51,7 @@ class StreamingHTTPResponse(BaseHTTPResponse):
streaming_fn, streaming_fn,
status=200, status=200,
headers=None, headers=None,
content_type="text/plain", content_type="text/plain; charset=utf-8",
chunked=True, chunked=True,
): ):
self.content_type = content_type self.content_type = content_type
@ -120,7 +120,7 @@ class HTTPResponse(BaseHTTPResponse):
body=None, body=None,
status=200, status=200,
headers=None, headers=None,
content_type="text/plain", content_type="text/plain; charset=utf-8",
body_bytes=b"", body_bytes=b"",
): ):
self.content_type = content_type self.content_type = content_type
@ -145,10 +145,6 @@ class HTTPResponse(BaseHTTPResponse):
"Content-Length", len(self.body) "Content-Length", len(self.body)
) )
self.headers["Content-Type"] = self.headers.get(
"Content-Type", self.content_type
)
if self.status in (304, 412): if self.status in (304, 412):
self.headers = remove_entity_headers(self.headers) self.headers = remove_entity_headers(self.headers)