forked from mirror/gin
Simplify code (#2004)
- Use buf.String instead of converison - Remove redundant return
This commit is contained in:
parent
502c898d75
commit
461df9320a
1
gin.go
1
gin.go
|
@ -437,7 +437,6 @@ func serveError(c *Context, code int, defaultMessage []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.writermem.WriteHeaderNow()
|
c.writermem.WriteHeaderNow()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func redirectTrailingSlash(c *Context) {
|
func redirectTrailingSlash(c *Context) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ func TestRenderMsgPack(t *testing.T) {
|
||||||
err = codec.NewEncoder(buf, h).Encode(data)
|
err = codec.NewEncoder(buf, h).Encode(data)
|
||||||
|
|
||||||
assert.NoError(t, err)
|
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"))
|
assert.Equal(t, "application/msgpack; charset=utf-8", w.Header().Get("Content-Type"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue