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:
Kacper Bąk 2022-04-23 12:01:03 +02:00 committed by GitHub
parent 444e156fb1
commit c706ace929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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")

View File

@ -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")
})