dont panic on missing headers in broker event (#963)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2019-11-20 10:55:47 +03:00 committed by Asim Aslam
parent 94d409b180
commit da6c1be607

View File

@ -169,6 +169,11 @@ func (s *rpcServer) createSubHandler(sb *subscriber, opts Options) broker.Handle
return func(p broker.Event) error {
msg := p.Message()
if msg.Header == nil {
// create empty map in case of headers empty to avoid panic later
msg.Header = make(map[string]string)
}
// get codec
ct := msg.Header["Content-Type"]