gRPC metadata
gRPC metadata is a collection of key-value pairs attached to an RPC separately from its protobuf message body. In this course, metadata carries authorization credentials and idempotency keys, providing functionality similar to HTTP headers.
Minimal example
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return status.Error(codes.Unauthenticated, "missing metadata")
}
tokens := md.Get("authorization")Learn this concept
Lesson 7.12 · Protobuf contracts in GoUsed in exercises
Exercise 7.13 · gRPC order servicePrerequisite conceptsgRPC