MCPcopy
hub / github.com/grpc/grpc-go / Pairs

Function Pairs

metadata/metadata.go:81–91  ·  view source on GitHub ↗

Pairs returns an MD formed by the mapping of key, value ... Pairs panics if len(kv) is odd. Only the following ASCII characters are allowed in keys: - digits: 0-9 - uppercase letters: A-Z (normalized to lower) - lowercase letters: a-z - special characters: -_. Uppercase letters are automatically c

(kv ...string)

Source from the content-addressed store, hash-verified

79// Keys beginning with "grpc-" are reserved for grpc-internal use only and may
80// result in errors if set in metadata.
81func Pairs(kv ...string) MD {
82 if len(kv)%2 == 1 {
83 panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv)))
84 }
85 md := make(MD, len(kv)/2)
86 for i := 0; i < len(kv); i += 2 {
87 key := strings.ToLower(kv[i])
88 md[key] = append(md[key], kv[i+1])
89 }
90 return md
91}
92
93// Len returns the number of items in md.
94func (md MD) Len() int {

Callers 15

newAttemptLockedMethod · 0.92
TestToLoadReportMethod · 0.92
setTrailerMetadataMethod · 0.92
TestCanceledStatusMethod · 0.92
setupStreamFunction · 0.92
test_utils.goFile · 0.92
UnaryCallMethod · 0.92
FullDuplexCallMethod · 0.92
PickMethod · 0.92
ConfigureMethod · 0.92
parseRPCMetadataFunction · 0.92
EmptyCallMethod · 0.92

Calls

no outgoing calls