From 461df9320ac22d12d19a4e93894c54dd113b60c3 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 27 Jul 2019 03:06:37 +0200 Subject: [PATCH] Simplify code (#2004) - Use buf.String instead of converison - Remove redundant return --- gin.go | 1 - render/render_test.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gin.go b/gin.go index 220f0401..cbdd080e 100644 --- a/gin.go +++ b/gin.go @@ -437,7 +437,6 @@ func serveError(c *Context, code int, defaultMessage []byte) { return } c.writermem.WriteHeaderNow() - return } func redirectTrailingSlash(c *Context) { diff --git a/render/render_test.go b/render/render_test.go index 9d7eaeef..acdb28ab 100644 --- a/render/render_test.go +++ b/render/render_test.go @@ -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")) }