Package list golang-github-go-kit-kit / 7edf859
opentracing/grpc fix: properly encode metadata key-value pairs Bas van Beek 5 years ago
1 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
00 package opentracing
11
22 import (
3 "encoding/base64"
4 "strings"
5
36 "github.com/opentracing/opentracing-go"
47 "golang.org/x/net/context"
58 "google.golang.org/grpc/metadata"
5255 }
5356
5457 func (w metadataReaderWriter) Set(key, val string) {
58 key = strings.ToLower(key)
59 if strings.HasSuffix(key, "-bin") {
60 val = string(base64.StdEncoding.EncodeToString([]byte(val)))
61 }
5562 (*w.MD)[key] = append((*w.MD)[key], val)
5663 }
5764