提交 730bf56e 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

日志中间件对于上传文件做body过滤处理

上级 7473cdfa
......@@ -64,11 +64,12 @@ func OperationRecord() gin.HandlerFunc {
Body: string(body),
UserID: userId,
}
// 存在某些未知错误 TODO
//values := c.Request.Header.Values("content-type")
//if len(values) >0 && strings.Contains(values[0], "boundary") {
// record.Body = "file"
//}
// 上传文件时候 中间件日志进行裁断操作
if strings.Index(c.GetHeader("Content-Type"), "multipart/form-data") > -1 {
if len(record.Body) > 512 {
record.Body = "File or Length out of limit"
}
}
writer := responseBodyWriter{
ResponseWriter: c.Writer,
body: &bytes.Buffer{},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册