diff --git a/main.py b/main.py index fb7262c..12b474c 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,7 @@ from pydantic import BaseModel from starlette.responses import FileResponse, JSONResponse from fastapi import FastAPI, File, UploadFile, Response, status, Request, Body from fastapi.responses import PlainTextResponse +from fastapi.middleware.gzip import GZipMiddleware from tjnetwork import * JUNCTION = 0 @@ -31,6 +32,8 @@ if not os.path.exists(tmpDir): app = FastAPI() +app.add_middleware(GZipMiddleware, minimum_size=1000) + ### project @app.get('/listprojects/') @@ -180,7 +183,7 @@ async def fastapi_take_snapshot_for_current_operation(network: str, tag: str) -> return take_snapshot_for_current_operation(network, tag) @app.post('/takesnapshot/') -def fastapi_take_snapshot(network: str, tag: str) -> int | None: +def fastapi_take_snapshot(network: str, tag: str) -> None: return take_snapshot(network, tag) @app.post('/picksnapshot/')