not use protobuf on context but use it on render (#1496)

This commit is contained in:
田欧
2018-08-19 17:39:58 +08:00
committed by GitHub
parent efdd3c8b81
commit 6073a79ee0
5 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import (
)
type ProtoBuf struct {
Data proto.Message
Data interface{}
}
var protobufContentType = []string{"application/x-protobuf"}
@ -19,7 +19,7 @@ var protobufContentType = []string{"application/x-protobuf"}
func (r ProtoBuf) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
bytes, err := proto.Marshal(r.Data)
bytes, err := proto.Marshal(r.Data.(proto.Message))
if err != nil {
return err
}