From 1acd1d7d88d55b6580f7d31bdf3af69da6e41dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Tue, 10 Sep 2019 14:58:22 +0300 Subject: [PATCH] Content-type fixes. --- sanic/response.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sanic/response.py b/sanic/response.py index 5f42fc1e..031edace 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -51,7 +51,7 @@ class StreamingHTTPResponse(BaseHTTPResponse): streaming_fn, status=200, headers=None, - content_type="text/plain", + content_type="text/plain; charset=utf-8", chunked=True, ): self.content_type = content_type @@ -120,7 +120,7 @@ class HTTPResponse(BaseHTTPResponse): body=None, status=200, headers=None, - content_type="text/plain", + content_type="text/plain; charset=utf-8", body_bytes=b"", ): self.content_type = content_type @@ -145,10 +145,6 @@ class HTTPResponse(BaseHTTPResponse): "Content-Length", len(self.body) ) - self.headers["Content-Type"] = self.headers.get( - "Content-Type", self.content_type - ) - if self.status in (304, 412): self.headers = remove_entity_headers(self.headers)