Method: Gem::Net::HTTPHeader#get_fields
- Defined in:
- lib/rubygems/net-http/lib/net/http/header.rb
#get_fields(key) ⇒ Object
Returns the array field value for the given key, or nil if there is no such field; see Fields:
res = Gem::Net::HTTP.get_response(hostname, '/todos/1')
res.get_fields('Connection') # => ["keep-alive"]
res.get_fields('Nosuch') # => nil
306 307 308 309 310 |
# File 'lib/rubygems/net-http/lib/net/http/header.rb', line 306 def get_fields(key) stringified_downcased_key = key.downcase.to_s return nil unless @header[stringified_downcased_key] @header[stringified_downcased_key].dup end |