From 24a7e29bb5511d4ab10320ab90affd586119d72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Silva?= Date: Thu, 9 Nov 2023 02:30:29 +0000 Subject: [PATCH] Enable gzip-compressing middleware (#80) https://fastapi.tiangolo.com/advanced/middleware/#gzipmiddleware --- src/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.py b/src/main.py index e9e159d..1a5de98 100644 --- a/src/main.py +++ b/src/main.py @@ -4,6 +4,7 @@ from fastapi import FastAPI, Header from fastapi.middleware.cors import CORSMiddleware +from fastapi.middleware.gzip import GZipMiddleware from fastapi.responses import ORJSONResponse from flag_engine.engine import ( get_environment_feature_state, @@ -133,4 +134,5 @@ async def refresh_cache(): allow_methods=["*"], allow_headers=["*"], ) +app.add_middleware(GZipMiddleware, minimum_size=1000) app.include_router(sse_router)