Class: GrpcKit::Session::Headers
- Inherits:
-
Struct
- Object
- Struct
- GrpcKit::Session::Headers
- Defined in:
- lib/grpc_kit/session/headers.rb
Constant Summary collapse
- RESERVED_HEADERS =
[ 'content-type', 'user-agent', 'grpc-message-type', 'grpc-encoding', 'grpc-message', 'grpc-status', 'grpc-status-details-bin', 'te' ].freeze
- METADATA_ACCEPTABLE_HEADER =
%w[authority user-agent].freeze
Instance Attribute Summary collapse
-
#grpc_encoding ⇒ Object
Returns the value of attribute grpc_encoding.
-
#grpc_status ⇒ Object
Returns the value of attribute grpc_status.
-
#http_status ⇒ Object
Returns the value of attribute http_status.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#status_message ⇒ Object
Returns the value of attribute status_message.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #add(key, val) ⇒ Object
-
#initialize ⇒ Headers
constructor
A new instance of Headers.
Constructor Details
#initialize ⇒ Headers
Returns a new instance of Headers.
30 31 32 |
# File 'lib/grpc_kit/session/headers.rb', line 30 def initialize super({}) # set metadata empty hash end |
Instance Attribute Details
#grpc_encoding ⇒ Object
Returns the value of attribute grpc_encoding
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def grpc_encoding @grpc_encoding end |
#grpc_status ⇒ Object
Returns the value of attribute grpc_status
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def grpc_status @grpc_status end |
#http_status ⇒ Object
Returns the value of attribute http_status
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def http_status @http_status end |
#metadata ⇒ Object
Returns the value of attribute metadata
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def @metadata end |
#method ⇒ Object
Returns the value of attribute method
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def method @method end |
#path ⇒ Object
Returns the value of attribute path
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def path @path end |
#status_message ⇒ Object
Returns the value of attribute status_message
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def @status_message end |
#timeout ⇒ Object
Returns the value of attribute timeout
7 8 9 |
# File 'lib/grpc_kit/session/headers.rb', line 7 def timeout @timeout end |
Instance Method Details
#add(key, val) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/grpc_kit/session/headers.rb', line 34 def add(key, val) case key when ':path' self.path = val when ':status' self.http_status = val.to_i when 'content-type' # TODO [key] = val when 'grpc-encoding' self.grpc_encoding = val when 'grpc-status' self.grpc_status = val.to_i when 'grpc-timeout' self.timeout = Duration.decode(val) when 'grpc-message' # TODO GrpcKit.logger.warn('grpc-message is unsupported header now') when 'grpc-status-details-bin' # TODO GrpcKit.logger.warn('grpc-status-details-bin is unsupported header now') else if RESERVED_HEADERS.include?(key) && !METADATA_ACCEPTABLE_HEADER.include?(key) return end [key] = val end end |