class Message
The grpc-message header represents the gRPC status message.
The grpc-message header contains a human-readable error message, URL-encoded according to RFC 3986.
This header is optional and typically only present when there's an error (non-zero status code).
This header can appear both as an initial header (for trailers-only responses) and as a trailer.
Definitions
def initialize(value)
Initialize the message header with the given value.
Signature
-
parameter
valueString The message value (will be URL-encoded if not already encoded).
Implementation
def initialize(value)
super(value.to_s)
end
def decode
Decode the URL-encoded message.
Signature
-
returns
String The decoded message.
Implementation
def decode
URI.decode_www_form_component(self)
end
def self.encode(message)
Encode the message for use in headers.
Signature
-
parameter
messageString The message to encode.
-
returns
String The URL-encoded message.
Implementation
def self.encode(message)
URI.encode_www_form_component(message).gsub("+", "%20")
end
def <<(value)
Merge another message value (takes the new value, as message should only appear once)
Signature
-
parameter
valueString The new message value
Implementation
def <<(value)
replace(value.to_s)
self
end
def self.trailer?
Whether this header is acceptable in HTTP trailers.
The grpc-message header can appear in trailers as per the gRPC specification.
Signature
-
returns
Boolean true, as grpc-message can appear in trailers.
Implementation
def self.trailer?
true
end