don't marshal frame values

This commit is contained in:
Asim Aslam 2019-12-31 21:36:22 +00:00
parent fa01ff6604
commit 45c986c5f1

View File

@ -186,32 +186,30 @@ func (c *rpcCodec) Write(m *codec.Message, body interface{}) error {
// if body is bytes Frame don't encode
if body != nil {
b, ok := body.(*raw.Frame)
if ok {
if b, ok := body.(*raw.Frame); ok {
// set body
m.Body = b.Data
body = nil
} else {
// write to codec
if err := c.codec.Write(m, body); err != nil {
return errors.InternalServerError("go.micro.client.codec", err.Error())
}
// set body
m.Body = c.buf.wbuf.Bytes()
}
}
if len(m.Body) == 0 {
// write to codec
if err := c.codec.Write(m, body); err != nil {
return errors.InternalServerError("go.micro.client.codec", err.Error())
}
// set body
m.Body = c.buf.wbuf.Bytes()
}
// create new transport message
msg := transport.Message{
Header: m.Header,
Body: m.Body,
}
// send the request
if err := c.client.Send(&msg); err != nil {
return errors.InternalServerError("go.micro.client.transport", err.Error())
}
return nil
}