email.go:再重新写回请求体body中,ioutil.ReadAll会清空c.Request.Body中的数据 (#1027)
Co-authored-by: oldlv <15237336850@163.com>
This commit is contained in:
parent
c7ce98f1d5
commit
c92a94bdd2
|
@ -1,6 +1,7 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
"time"
|
||||
|
@ -32,6 +33,8 @@ func ErrorToEmail() gin.HandlerFunc {
|
|||
username = user.Username
|
||||
}
|
||||
body, _ := ioutil.ReadAll(c.Request.Body)
|
||||
// 再重新写回请求体body中,ioutil.ReadAll会清空c.Request.Body中的数据
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
record := system.SysOperationRecord{
|
||||
Ip: c.ClientIP(),
|
||||
Method: c.Request.Method,
|
||||
|
|
Loading…
Reference in New Issue