mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
server/grpc: avoid panic in case of nil Header (#1303)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
ce2ba71002
commit
d807dac2a7
@ -178,6 +178,11 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke
|
||||
}()
|
||||
|
||||
msg := p.Message()
|
||||
// if we don't ave headers, create empty map
|
||||
if msg.Header == nil {
|
||||
msg.Header = make(map[string]string)
|
||||
}
|
||||
|
||||
ct := msg.Header["Content-Type"]
|
||||
if len(ct) == 0 {
|
||||
msg.Header["Content-Type"] = defaultContentType
|
||||
|
Loading…
Reference in New Issue
Block a user