Commit f2767dca by zhengqiuyun86

验证错误未抛

parent 621b06e1
......@@ -51,7 +51,10 @@ type Admin struct {
const requestBodyKey = "requestBody"
func BindRequestBody(c *gin.Context, param interface{}) error {
c.ShouldBindJSON(param)
err := c.ShouldBindJSON(param)
if err != nil {
return err
}
bytes, err := json.Marshal(param)
c.Set(requestBodyKey, string(bytes))
return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment