Skip to content

Commit

Permalink
set key value only when match found
Browse files Browse the repository at this point in the history
  • Loading branch information
cdvr1993 committed Dec 8, 2023
1 parent c0da462 commit 97a1986
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions baggage/baggage.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,10 @@ func parsePropertyInternal(s string) (p Property, ok bool) {

index = skipSpace(s, keyEnd)

p.key = s[keyStart:keyEnd]

if index == len(s) {
// There is only a key (no value).
ok = true
p.key = s[keyStart:keyEnd]
return
}

Expand Down Expand Up @@ -584,6 +583,7 @@ func parsePropertyInternal(s string) (p Property, ok bool) {
}

ok = true
p.key = s[keyStart:keyEnd]
// If there is a delimiter, we set hasValue to true even if the value is empty.
p.hasValue = true
p.value = s[valueStart:valueEnd]
Expand Down

0 comments on commit 97a1986

Please sign in to comment.