fix: bind json

master
howell 3 years ago
parent 225b000268
commit d147dc6f6e

@ -60,7 +60,7 @@ func ParseParams(p interface{}, c *gin.Context) error {
func Params(p interface{}, c *gin.Context) error { func Params(p interface{}, c *gin.Context) error {
ct := strings.ToLower(c.Request.Header.Get("Content-Type")) ct := strings.ToLower(c.Request.Header.Get("Content-Type"))
if strings.Contains(ct, "application/json") { if strings.Contains(ct, "application/json") {
err := c.BindJSON(p) err := c.ShouldBindJSON(p)
if err != nil { if err != nil {
return err return err
} }

Loading…
Cancel
Save