MCPcopy
hub / github.com/connectrpc/connect-go / EncodeBinaryHeader

Function EncodeBinaryHeader

header.go:52–55  ·  view source on GitHub ↗

EncodeBinaryHeader base64-encodes the data. It always emits unpadded values. In the Connect, gRPC, and gRPC-Web protocols, binary headers must have keys ending in "-Bin".

(data []byte)

Source from the content-addressed store, hash-verified

50// In the Connect, gRPC, and gRPC-Web protocols, binary headers must have keys
51// ending in "-Bin".
52func EncodeBinaryHeader(data []byte) string {
53 // gRPC specification says that implementations should emit unpadded values.
54 return base64.RawStdEncoding.EncodeToString(data)
55}
56
57// DecodeBinaryHeader base64-decodes the data. It can decode padded or unpadded
58// values. Following usual HTTP semantics, multiple base64-encoded values may

Callers 2

TestBinaryEncodingQuickFunction · 0.85
grpcErrorToTrailerFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBinaryEncodingQuickFunction · 0.68