fix: removed YODA conditions, removed blank identifier from invalid_obj
(#3129)
* fix: removed YODA conditions, unnecessary binding.binding * fix: remove BindingBody change
This commit is contained in:
parent
444e156fb1
commit
c706ace929
@ -1339,10 +1339,10 @@ func testProtoBodyBindingFail(t *testing.T, b Binding, name, path, badPath, body
|
||||
err := b.Bind(req, &obj)
|
||||
assert.Error(t, err)
|
||||
|
||||
invalid_obj := FooStruct{}
|
||||
invalidobj := FooStruct{}
|
||||
req.Body = ioutil.NopCloser(strings.NewReader(`{"msg":"hello"}`))
|
||||
req.Header.Add("Content-Type", MIMEPROTOBUF)
|
||||
err = b.Bind(req, &invalid_obj)
|
||||
err = b.Bind(req, &invalidobj)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, err.Error(), "obj is not ProtoMessage")
|
||||
|
||||
|
@ -296,8 +296,8 @@ func TestShouldBindUri(t *testing.T) {
|
||||
router.Handle(http.MethodGet, "/rest/:name/:id", func(c *Context) {
|
||||
var person Person
|
||||
assert.NoError(t, c.ShouldBindUri(&person))
|
||||
assert.True(t, "" != person.Name)
|
||||
assert.True(t, "" != person.ID)
|
||||
assert.True(t, person.Name != "")
|
||||
assert.True(t, person.ID != "")
|
||||
c.String(http.StatusOK, "ShouldBindUri test OK")
|
||||
})
|
||||
|
||||
@ -318,8 +318,8 @@ func TestBindUri(t *testing.T) {
|
||||
router.Handle(http.MethodGet, "/rest/:name/:id", func(c *Context) {
|
||||
var person Person
|
||||
assert.NoError(t, c.BindUri(&person))
|
||||
assert.True(t, "" != person.Name)
|
||||
assert.True(t, "" != person.ID)
|
||||
assert.True(t, person.Name != "")
|
||||
assert.True(t, person.ID != "")
|
||||
c.String(http.StatusOK, "BindUri test OK")
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user