From 347143ab44979208ae0f5ad5a9e544166b1b70c6 Mon Sep 17 00:00:00 2001 From: magmaus3 Date: Sun, 27 Nov 2022 14:24:42 +0100 Subject: [PATCH] Add GZip compression --- iwm_browser/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iwm_browser/main.py b/iwm_browser/main.py index 00878ba..8208ed2 100644 --- a/iwm_browser/main.py +++ b/iwm_browser/main.py @@ -1,5 +1,6 @@ from typing import Union from fastapi.staticfiles import StaticFiles +from fastapi.middleware.gzip import GZipMiddleware from fastapi.responses import HTMLResponse, PlainTextResponse from fastapi import FastAPI, Form, Response import jinja2 @@ -15,6 +16,7 @@ from . import __version__ basedir = os.path.dirname(__file__) app = FastAPI(openapi_url=None) +app.add_middleware(GZipMiddleware) app.mount("/static", StaticFiles(directory=basedir + "/static"), name="static") template_env = jinja2.Environment(