class Seahorse::Client::Http::Headers


#=> { ‘content-length’ => ‘100’, ‘authorization’ => ‘Abc’ }
headers.to_h
You can get the header values as a vanilla hash by calling {#to_h}:
#=> [‘100’, ‘Abc’]
headers.values
#=> [‘content-length’, ‘authorization’]<br>headers.keys<br><br>headers = ‘Abc’<br>headers = 100
headers = Http::Headers.new
are cast to strings.
are treated indifferently as lower-cased strings. Header values
Provides a Hash-like interface for HTTP headers. Header names

def [](key)

Returns:
  • (String) -

Parameters:
  • key (String) --
def [](key)
  @data[key.to_s.downcase]
end

def []=(key, value)

Parameters:
  • value (String) --
  • key (String) --
def []=(key, value)
  @data[key.to_s.downcase] = value.to_s
end

def clear

def clear
  @data = {}
end

def delete(key)

Parameters:
  • key (String) --
def delete(key)
  @data.delete(key.to_s.downcase)
end

def each(&block)

Returns:
  • (nil) -

Other tags:
    Yieldparam: value -
    Yieldparam: key -

Other tags:
    Yield: -
def each(&block)
  if block_given?
    @data.each_pair do |key, value|
      yield(key, value)
    end
    nil
  else
    @data.enum_for(:each)
  end
end

def initialize(headers = {})

Other tags:
    Api: - private
def initialize(headers = {})
  @data = {}
  headers.each_pair do |key, value|
    self[key] = value
  end
end

def inspect

Other tags:
    Api: - private
def inspect
  @data.inspect
end

def key?(key)

Returns:
  • (Boolean) - Returns `true` if the header is set.
def key?(key)
  @data.key?(key.to_s.downcase)
end

def keys

Returns:
  • (Array) -
def keys
  @data.keys
end

def to_hash

Returns:
  • (Hash) -
def to_hash
  @data.dup
end

def update(headers)

Returns:
  • (Headers) -

Parameters:
  • headers (Hash) --
def update(headers)
  headers.each_pair do |k, v|
    self[k] = v
  end
  self
end

def values

Returns:
  • (Array) -
def values
  @data.values
end

def values_at(*keys)

Returns:
  • (Array) -
def values_at(*keys)
  @data.values_at(*keys.map{ |key| key.to_s.downcase })
end