Use gzip middleware
This commit is contained in:
5
main.py
5
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/')
|
||||
|
||||
Reference in New Issue
Block a user