minor tweaks

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-07-31 14:59:09 +03:00
parent 09e7282b2b
commit 73fc3d34f0

10
http.go
View File

@ -549,13 +549,15 @@ func (h *httpClient) publish(ctx context.Context, ps []client.Message, opts ...c
exchange = v exchange = v
} }
omd, ok := metadata.FromOutgoingContext(ctx)
if !ok {
omd = metadata.New(2)
}
msgs := make([]*broker.Message, 0, len(ps)) msgs := make([]*broker.Message, 0, len(ps))
for _, p := range ps { for _, p := range ps {
md, ok := metadata.FromOutgoingContext(ctx) md := metadata.Copy(omd)
if !ok {
md = metadata.New(2)
}
md[metadata.HeaderContentType] = p.ContentType() md[metadata.HeaderContentType] = p.ContentType()
md[metadata.HeaderTopic] = p.Topic() md[metadata.HeaderTopic] = p.Topic()