Nitpick Headers to Header
This commit is contained in:
parent
cd9801891e
commit
d306559d8f
@ -109,13 +109,13 @@ func (c *rpcPlusCodec) WriteRequest(req *request, body interface{}) error {
|
||||
Target: req.Service,
|
||||
Method: req.ServiceMethod,
|
||||
Type: codec.Request,
|
||||
Headers: map[string]string{},
|
||||
Header: map[string]string{},
|
||||
}
|
||||
if err := c.codec.Write(m, body); err != nil {
|
||||
return err
|
||||
}
|
||||
c.req.Body = c.buf.wbuf.Bytes()
|
||||
for k, v := range m.Headers {
|
||||
for k, v := range m.Header {
|
||||
c.req.Header[k] = v
|
||||
}
|
||||
return c.client.Send(c.req)
|
||||
|
@ -38,5 +38,5 @@ type Message struct {
|
||||
Target string
|
||||
Method string
|
||||
Error string
|
||||
Headers map[string]string
|
||||
Header map[string]string
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func newRpcPlusCodec(req *transport.Message, socket transport.Socket, c codec.Ne
|
||||
}
|
||||
|
||||
func (c *rpcPlusCodec) ReadRequestHeader(r *request, first bool) error {
|
||||
m := codec.Message{Headers: c.req.Header}
|
||||
m := codec.Message{Header: c.req.Header}
|
||||
|
||||
if !first {
|
||||
var tm transport.Message
|
||||
@ -73,7 +73,7 @@ func (c *rpcPlusCodec) ReadRequestHeader(r *request, first bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m.Headers = tm.Header
|
||||
m.Header = tm.Header
|
||||
}
|
||||
|
||||
err := c.codec.ReadHeader(&m, codec.Request)
|
||||
@ -93,15 +93,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{},
|
||||
Header: map[string]string{},
|
||||
}
|
||||
if err := c.codec.Write(m, body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m.Headers["Content-Type"] = c.req.Header["Content-Type"]
|
||||
m.Header["Content-Type"] = c.req.Header["Content-Type"]
|
||||
return c.socket.Send(&transport.Message{
|
||||
Header: m.Headers,
|
||||
Header: m.Header,
|
||||
Body: c.buf.wbuf.Bytes(),
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user