From 607cec1ebaf7484ed0410102934f7884c6cb73f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E7=93=9C=E4=B8=B8?= Date: Mon, 5 Oct 2020 22:01:04 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20content-type=E3=81=AE=E9=80=81=E5=87=BA?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mitama/app/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mitama/app/__init__.py b/mitama/app/__init__.py index ba2662a..0596beb 100644 --- a/mitama/app/__init__.py +++ b/mitama/app/__init__.py @@ -85,11 +85,9 @@ def handle(self, req: Request): for path in self.paths: filename = path / req.params['path'] if filename.is_file(): - mime = guess_type(str(filename)) or 'application/octet-stream' + mime = guess_type(str(filename)) or ('application/octet-stream', ) with open(filename, 'rb') as f: - return Response(body = f.read(), headers={ - 'content-type': mime[0] - }) + return Response(body = f.read(), content_type = mime[0]) for path in self.paths: filename = path / '404.html' if filename.is_file():