Merge pull request 'client/noop: fix metadata overwrite' (#284) from noopfix into v3

Reviewed-on: #284
This commit is contained in:
Василий Толстов 2023-12-21 00:07:22 +03:00
commit fb43e8c58c

View File

@ -486,11 +486,12 @@ func (n *noopClient) publish(ctx context.Context, ps []Message, opts ...PublishO
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) omd, ok := metadata.FromOutgoingContext(ctx)
if !ok { if !ok {
md = metadata.New(0) omd = metadata.New(0)
} }
md := metadata.Copy(omd)
iter := p.Metadata().Iterator() iter := p.Metadata().Iterator()
var k, v string var k, v string
for iter.Next(&k, &v) { for iter.Next(&k, &v) {