gRPC metadata is a name-value map carried in HTTP/2 HEADERS
frames at the start (initial metadata) and after the body
(trailing metadata) of every call. The keys are ASCII-only
(lowercased on the wire), and values come in two flavours:
- Text keys (most): name ends in any suffix except
-bin;
value must be printable ASCII (subset of HTTP field-content
per the gRPC spec).
- Binary keys: name ends in
-bin (e.g. trace-bin);
value is arbitrary bytes encoded as base64 on the HTTP/2 wire.
At the application layer the caller works with the raw bytes
and the framing layer base64-encodes on egress, decodes on
ingress.
Reserved keys begin with grpc- and are managed by the
framework (e.g. grpc-status, grpc-message,
grpc-encoding, grpc-timeout). The carrier rejects writes
to reserved keys to keep handler code from accidentally clobbering
framework-controlled trailers.
References: