Merge 17cc6e95e68fb6e96607544562c27e7419fdf3ea into ae9f03e6e80212e45427f811683f2a512cc8f506

This commit is contained in:
aghasoroush 2017-11-13 19:53:44 +00:00 committed by GitHub
commit 73a97443c0
2 changed files with 3 additions and 3 deletions

View File

@ -469,11 +469,11 @@ func (c *Context) BindQuery(obj interface{}) error {
}
// MustBindWith binds the passed struct pointer using the specified binding engine.
// It will abort the request with HTTP 400 if any error ocurrs.
// It will abort the request with HTTP 422(Unprocessable Entity) if any error ocurrs.
// See the binding package.
func (c *Context) MustBindWith(obj interface{}, b binding.Binding) (err error) {
if err = c.ShouldBindWith(obj, b); err != nil {
c.AbortWithError(400, err).SetType(ErrorTypeBind)
c.AbortWithError(422, err).SetType(ErrorTypeBind)
}
return

View File

@ -1224,7 +1224,7 @@ func TestContextBadAutoBind(t *testing.T) {
assert.Empty(t, obj.Bar)
assert.Empty(t, obj.Foo)
assert.Equal(t, w.Code, 400)
assert.Equal(t, w.Code, 422)
assert.True(t, c.IsAborted())
}