You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Seahorse::Client::Http::HeadersProvides a Hash-like interface for HTTP headers. Header names are treated indifferently as lower-cased strings. Header values are cast to strings.
= Http::Headers.new
['Content-Length'] = 100
[:Authorization] = 'Abc'
.keys
.values
You can get the header values as a vanilla hash by calling #to_h:
.to_h
Attribute Summary collapse
Returns true
if the header is set.
38 39 40
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 38 def [](key) @data[key.to_s.downcase] end#[]=(key, value) ⇒ Object
44 45 46
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 44 def []=(key, value) @data[key.to_s.downcase] = value.to_s end#clear ⇒ Object
62 63 64
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 62 def clear @data = {} end#delete(key) ⇒ Object
58 59 60
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 58 def delete(key) @data.delete(key.to_s.downcase) end#each {|key, value| ... } ⇒ nil Also known as: each_pair
85 86 87 88 89 90 91 92 93 94
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 85 def each(&block) if block_given? @data.each_pair do |key, value| yield(key, value) end nil else @data.enum_for(:each) end end#key?(key) ⇒ Boolean Also known as: has_key?, include?
Returns true
if the header is set.
98 99 100
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 98 def key?(key) @data.key?(key.to_s.downcase) end#keys ⇒ Array<String>
67 68 69
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 67 def keys @data.keys end#to_hash ⇒ Hash Also known as: to_h
105 106 107
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 105 def to_hash @data.dup end#update(headers) ⇒ Headers
50 51 52 53 54 55
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 50 def update() .each_pair do |k, v| self[k] = v end self end#values ⇒ Array<String>
72 73 74
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 72 def values @data.values end#values_at(*keys) ⇒ Array<String>
77 78 79
# File 'aws-sdk-core/lib/seahorse/client/http/headers.rb', line 77 def values_at(*keys) @data.values_at(*keys.map{ |key| key.to_s.downcase }) end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4