mirror of https://github.com/gin-gonic/gin.git
Use buf.String() instead of string(buf.Bytes()) (#2764)
This commit is contained in:
parent
7834a03e84
commit
f2bbdfe9f2
|
@ -13,6 +13,8 @@ import (
|
||||||
"github.com/ugorji/go/codec"
|
"github.com/ugorji/go/codec"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Check interface implemented here to support go build tag nomsgpack.
|
||||||
|
// See: https://github.com/gin-gonic/gin/pull/1852/
|
||||||
var (
|
var (
|
||||||
_ Render = MsgPack{}
|
_ Render = MsgPack{}
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,6 +39,6 @@ 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