1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Support micro proxy

This commit is contained in:
Asim Aslam
2019-01-30 18:42:11 +00:00
parent 107b571019
commit b1a31134bd
3 changed files with 28 additions and 9 deletions

View File

@ -115,6 +115,9 @@ func getHeaders(m *codec.Message) {
func setHeaders(m *codec.Message) {
set := func(hdr, v string) {
if len(v) == 0 {
return
}
m.Header[hdr] = v
m.Header["X-"+hdr] = v
}
@ -200,12 +203,10 @@ func (c *rpcCodec) Write(m *codec.Message, body interface{}) error {
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
}