Files
new-api/middleware/body_cleanup.go

23 lines
514 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package middleware
import (
"github.com/QuantumNous/new-api/common"
"github.com/QuantumNous/new-api/service"
"github.com/gin-gonic/gin"
)
// BodyStorageCleanup 请求体存储清理中间件
// 在请求处理完成后自动清理磁盘/内存缓存
func BodyStorageCleanup() gin.HandlerFunc {
return func(c *gin.Context) {
// 处理请求
c.Next()
// 请求结束后清理存储
common.CleanupBodyStorage(c)
// 清理文件缓存URL 下载的文件等)
service.CleanupFileSources(c)
}
}