feat: 初始化仓库
This commit is contained in:
19
middlewares/gzip.py
Normal file
19
middlewares/gzip.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# _*_ coding : UTF-8 _*_
|
||||
# @Time : 2025/01/18 02:45
|
||||
# @UpdateTime : 2025/01/18 02:45
|
||||
# @Author : sonder
|
||||
# @File : gzip.py
|
||||
# @Software : PyCharm
|
||||
# @Comment : 本程序
|
||||
from fastapi import FastAPI
|
||||
from starlette.middleware.gzip import GZipMiddleware
|
||||
|
||||
|
||||
def add_gzip_middleware(app: FastAPI):
|
||||
"""
|
||||
添加gzip压缩中间件
|
||||
|
||||
:param app: FastAPI对象
|
||||
:return:
|
||||
"""
|
||||
app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=9)
|
||||
Reference in New Issue
Block a user