mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
Initialize header to prevent assignment to entry in nil map error (#1282)
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
1f2e067f71
commit
7cad77bfc0
@ -192,6 +192,9 @@ func (h *httpTransportSocket) Recv(m *Message) error {
|
||||
if m == nil {
|
||||
return errors.New("message passed in is nil")
|
||||
}
|
||||
if m.Header == nil {
|
||||
m.Header = make(map[string]string, len(h.r.Header))
|
||||
}
|
||||
|
||||
// process http 1
|
||||
if h.r.ProtoMajor == 1 {
|
||||
@ -224,10 +227,6 @@ func (h *httpTransportSocket) Recv(m *Message) error {
|
||||
r.Body.Close()
|
||||
m.Body = b
|
||||
|
||||
if m.Header == nil {
|
||||
m.Header = make(map[string]string, len(r.Header))
|
||||
}
|
||||
|
||||
// set headers
|
||||
for k, v := range r.Header {
|
||||
if len(v) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user