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

Function New

metadata/metadata.go:59–66  ·  view source on GitHub ↗

New creates an MD from a given key-value map. 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 converted to lowercase. Keys beginning with "g

(m map[string]string)

Source from the content-addressed store, hash-verified

57// Keys beginning with "grpc-" are reserved for grpc-internal use only and may
58// result in errors if set in metadata.
59func New(m map[string]string) MD {
60 md := make(MD, len(m))
61 for k, val := range m {
62 key := strings.ToLower(k)
63 md[key] = append(md[key], val)
64 }
65 return md
66}
67
68// Pairs returns an MD formed by the mapping of key, value ...
69// Pairs panics if len(kv) is odd.

Callers 10

TestContextCanceledMethod · 0.92
UnaryEchoMethod · 0.92
ServerStreamingEchoMethod · 0.92
ClientStreamingEchoMethod · 0.92
TestGetLabelsMethod · 0.92
GetMetadataMethod · 0.92

Calls

no outgoing calls