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