|
|
@@ -21,6 +21,14 @@ func AppendToContext(ctx context.Context, key string, value interface{}) context
|
|
|
_value = fmt.Sprint(value)
|
|
|
break
|
|
|
}
|
|
|
- ctx = metadata.AppendToOutgoingContext(ctx, key, _value)
|
|
|
+ md, ok := metadata.FromOutgoingContext(ctx)
|
|
|
+ if !ok {
|
|
|
+ md = make(map[string][]string)
|
|
|
+ md.Set(key, _value)
|
|
|
+ ctx = metadata.NewOutgoingContext(ctx, md)
|
|
|
+ return ctx
|
|
|
+ }
|
|
|
+ md.Set(key, _value)
|
|
|
+ ctx = metadata.NewOutgoingContext(ctx, md)
|
|
|
return ctx
|
|
|
}
|