We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48ff873 commit f7a8bb2Copy full SHA for f7a8bb2
http/controller/base_controller.go
@@ -2,6 +2,7 @@ package controller
2
3
import (
4
"github.com/gin-gonic/gin"
5
+ "github.com/gin-gonic/gin/binding"
6
"gopkg.in/go-playground/validator.v9"
7
"net/http"
8
)
@@ -13,7 +14,7 @@ type Controller interface {
13
14
type BaseController struct{}
15
16
func (bc *BaseController) Validate(c *gin.Context, _validator interface{}) bool {
- if err := c.ShouldBindJSON(_validator); err != nil {
17
+ if err := c.ShouldBindWith(_validator, binding.JSON); err != nil {
18
19
_ = err.(validator.ValidationErrors)
20
//@todo translate
0 commit comments