Appending to metadata is a side effect. Let's not do that anymore.
This commit is contained in:
@@ -17,12 +17,5 @@ func FromContext(ctx context.Context) (Metadata, bool) {
|
||||
}
|
||||
|
||||
func NewContext(ctx context.Context, md Metadata) context.Context {
|
||||
if emd, ok := ctx.Value(metaKey{}).(Metadata); ok {
|
||||
for k, v := range emd {
|
||||
if _, ok := md[k]; !ok {
|
||||
md[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
return context.WithValue(ctx, metaKey{}, md)
|
||||
}
|
||||
|
Reference in New Issue
Block a user