allow custom error handle

This commit is contained in:
sidbusy 2016-07-13 12:30:09 +08:00 committed by GitHub
parent f931d1ea80
commit 05c2fda5b7

View File

@ -296,11 +296,7 @@ func (c *Context) BindJSON(obj interface{}) error {
// BindWith binds the passed struct pointer using the specified binding engine.
// See the binding package.
func (c *Context) BindWith(obj interface{}, b binding.Binding) error {
if err := b.Bind(c.Request, obj); err != nil {
c.AbortWithError(400, err).SetType(ErrorTypeBind)
return err
}
return nil
return b.Bind(c.Request, obj)
}
// ClientIP implements a best effort algorithm to return the real client IP, it parses