Simplify code (#2004)

- Use buf.String instead of converison
- Remove redundant return
This commit is contained in:
Christian Muehlhaeuser 2019-07-27 03:06:37 +02:00 committed by thinkerou
parent 502c898d75
commit 461df9320a
2 changed files with 1 additions and 2 deletions

1
gin.go
View File

@ -437,7 +437,6 @@ func serveError(c *Context, code int, defaultMessage []byte) {
return
}
c.writermem.WriteHeaderNow()
return
}
func redirectTrailingSlash(c *Context) {

View File

@ -45,7 +45,7 @@ func TestRenderMsgPack(t *testing.T) {
err = codec.NewEncoder(buf, h).Encode(data)
assert.NoError(t, err)
assert.Equal(t, w.Body.String(), string(buf.Bytes()))
assert.Equal(t, w.Body.String(), buf.String())
assert.Equal(t, "application/msgpack; charset=utf-8", w.Header().Get("Content-Type"))
}