Skip to content

Commit

Permalink
Trim baggage key when parsing (#566)
Browse files Browse the repository at this point in the history
Signed-off-by: lastchiliarch <lastchiliarch@gmail.com>
  • Loading branch information
lastchiliarch committed Mar 25, 2021
1 parent 0dab782 commit 41d5398
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion propagation.go
Expand Up @@ -292,7 +292,7 @@ func (p *TextMapPropagator) parseCommaSeparatedMap(value string) map[string]stri
for _, kvpair := range strings.Split(value, ",") {
kv := strings.Split(strings.TrimSpace(kvpair), "=")
if len(kv) == 2 {
baggage[kv[0]] = kv[1]
baggage[strings.TrimSpace(kv[0])] = kv[1]
} else {
log.Printf("Malformed value passed in for %s", p.headerKeys.JaegerBaggageHeader)
}
Expand Down
1 change: 1 addition & 0 deletions propagation_test.go
Expand Up @@ -257,6 +257,7 @@ func TestParseCommaSeperatedMap(t *testing.T) {
{"malformed", map[string]string{}},
{"malformed, string", map[string]string{}},
{"another malformed string", map[string]string{}},
{"key2=value2, key3 = value3 ", map[string]string{"key2": "value2", "key3": " value3"}},
}

for _, testcase := range testcases {
Expand Down

0 comments on commit 41d5398

Please sign in to comment.