Sha256: 8bdbb285500c23a35ad18fd8438e30376733df42b811d64d6a33ca3f6d1ca9bd
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true require 'grpc_kit/grpc_time' module GrpcKit module Session Headers = Struct.new( :metadata, :path, :grpc_encoding, :grpc_status, :status_message, :timeout, :method, :http_status, ) do 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 def initialize super({}) # set metadata empty hash end def add(key, val) case key when ':path' self.path = val when ':status' self.http_status = Integer(val) when 'content-type' # TODO metadata[key] = val when 'grpc-encoding' self.grpc_encoding = val when 'grpc-status' self.grpc_status = val when 'grpc-timeout' self.timeout = GrpcTime.new(val) when 'grpc-message' self.status_message = val 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 metadata[key] = val end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grpc_kit-0.1.4 | lib/grpc_kit/session/headers.rb |