You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					13 lines
				
				287 B
			
		
		
			
		
	
	
					13 lines
				
				287 B
			| 
											1 year ago
										 | from fastapi import FastAPI | ||
|  | from starlette.middleware.gzip import GZipMiddleware | ||
|  | 
 | ||
|  | 
 | ||
|  | def add_gzip_middleware(app: FastAPI): | ||
| 
											1 year ago
										 |     """
 | ||
|  |     添加gzip压缩中间件 | ||
|  | 
 | ||
|  |     :param app: FastAPI对象 | ||
|  |     :return: | ||
|  |     """
 | ||
| 
											1 year ago
										 |     app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=9) |