github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/kit/httptransport/httpx/httpx_mimes_util.go (about) 1 package httpx 2 3 import "github.com/golang/protobuf/proto" 4 5 func NewApplicationProtobufWith(msg proto.Message) (*ApplicationProtobuf, error) { 6 w := NewApplicationProtobuf() 7 data, err := proto.Marshal(msg) 8 if err != nil { 9 return nil, err 10 } 11 _, err = w.Write(data) 12 if err != nil { 13 return nil, err 14 } 15 return w, nil 16 }