metadata: fix for grpc case (#370)
All checks were successful
test / test (push) Successful in 42s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Reviewed-on: #370
This commit is contained in:
2024-12-09 19:06:49 +03:00
parent 38c5fe8b5a
commit 2b62ad04f2
2 changed files with 15 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ package metadata
import (
"net/textproto"
"sort"
"strings"
)
var (
@@ -73,6 +74,9 @@ func (md Metadata) Get(key string) (string, bool) {
if !ok {
// slow path
val, ok = md[textproto.CanonicalMIMEHeaderKey(key)]
if !ok {
val, ok = md[strings.ToLower(key)]
}
}
return val, ok
}
@@ -94,6 +98,8 @@ func (md Metadata) Del(keys ...string) {
delete(md, key)
// slow path
delete(md, textproto.CanonicalMIMEHeaderKey(key))
// very slow path
delete(md, strings.ToLower(key))
}
}