| 123456789101112131415161718 |
- package middleware
- import (
- "github.com/QuantumNous/new-api/common"
- "github.com/gin-gonic/gin"
- )
- // BodyStorageCleanup 请求体存储清理中间件
- // 在请求处理完成后自动清理磁盘/内存缓存
- func BodyStorageCleanup() gin.HandlerFunc {
- return func(c *gin.Context) {
- // 处理请求
- c.Next()
- // 请求结束后清理存储
- common.CleanupBodyStorage(c)
- }
- }
|