render: update msgpack usage (#1498)

please see msgpack usage: https://github.com/ugorji/go/tree/master/codec#usage
This commit is contained in:
田欧 2018-08-19 22:14:02 +08:00 committed by Bo-Yi Wu
parent 6073a79ee0
commit 32b58e0fd2
1 changed files with 2 additions and 2 deletions

View File

@ -26,6 +26,6 @@ func (r MsgPack) Render(w http.ResponseWriter) error {
func WriteMsgPack(w http.ResponseWriter, obj interface{}) error { func WriteMsgPack(w http.ResponseWriter, obj interface{}) error {
writeContentType(w, msgpackContentType) writeContentType(w, msgpackContentType)
var h codec.Handle = new(codec.MsgpackHandle) var mh codec.MsgpackHandle
return codec.NewEncoder(w, h).Encode(obj) return codec.NewEncoder(w, &mh).Encode(obj)
} }