move msgpack interface implementation check variable to render.go

This commit is contained in:
zihengCat 2021-06-24 23:19:45 +08:00
parent 7834a03e84
commit 2816bb7cdc
3 changed files with 2 additions and 5 deletions

View File

@ -13,10 +13,6 @@ import (
"github.com/ugorji/go/codec"
)
var (
_ Render = MsgPack{}
)
// MsgPack contains the given interface object.
type MsgPack struct {
Data interface{}

View File

@ -30,6 +30,7 @@ var (
_ Render = Reader{}
_ Render = AsciiJSON{}
_ Render = ProtoBuf{}
_ Render = MsgPack{}
)
func writeContentType(w http.ResponseWriter, value []string) {

View File

@ -39,6 +39,6 @@ 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"))
}