add headers
This commit is contained in:
parent
271b827aa9
commit
ba3b056e76
@ -61,7 +61,10 @@ func newRpcPlusCodec(req *transport.Message, socket transport.Socket, c codec.Ne
|
||||
}
|
||||
|
||||
func (c *rpcPlusCodec) ReadRequestHeader(r *request) error {
|
||||
var m codec.Message
|
||||
m := codec.Message{
|
||||
Headers: c.req.Header,
|
||||
}
|
||||
|
||||
err := c.codec.ReadHeader(&m, codec.Request)
|
||||
r.ServiceMethod = m.Method
|
||||
r.Seq = m.Id
|
||||
@ -79,12 +82,15 @@ func (c *rpcPlusCodec) WriteResponse(r *response, body interface{}, last bool) e
|
||||
Id: r.Seq,
|
||||
Error: r.Error,
|
||||
Type: codec.Response,
|
||||
Headers: map[string]string{},
|
||||
}
|
||||
if err := c.codec.Write(m, body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m.Headers["Content-Type"] = c.req.Header["Content-Type"]
|
||||
return c.socket.Send(&transport.Message{
|
||||
Header: map[string]string{"Content-Type": c.req.Header["Content-Type"]},
|
||||
Header: m.Headers,
|
||||
Body: c.buf.wbuf.Bytes(),
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user