From 73fc3d34f009f475f14dac2dda12fb425daeb661 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 31 Jul 2021 14:59:09 +0300 Subject: [PATCH] minor tweaks Signed-off-by: Vasiliy Tolstov --- http.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/http.go b/http.go index 9bab942..5d6177d 100644 --- a/http.go +++ b/http.go @@ -549,13 +549,15 @@ func (h *httpClient) publish(ctx context.Context, ps []client.Message, opts ...c exchange = v } + omd, ok := metadata.FromOutgoingContext(ctx) + if !ok { + omd = metadata.New(2) + } + msgs := make([]*broker.Message, 0, len(ps)) for _, p := range ps { - md, ok := metadata.FromOutgoingContext(ctx) - if !ok { - md = metadata.New(2) - } + md := metadata.Copy(omd) md[metadata.HeaderContentType] = p.ContentType() md[metadata.HeaderTopic] = p.Topic()