End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#get_fields
get_fields(key)
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/net/http/header.rb, line 115
def get_fields(key)
stringified_downcased_key = key.downcase.to_s
return nil unless @header[stringified_downcased_key]
@header[stringified_downcased_key].dup
end
- Ruby 1.8.3
-
Returns an array of header field strings corresponding to the case-insensitive
key. This method allows you to get duplicated header fields without any processing. See also[].p response.get_fields('Set-Cookie') #=> ["session=al98axx; expires=Fri, 31-Dec-1999 23:58:23", "query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"] p response['Set-Cookie'] #=> "session=al98axx; expires=Fri, 31-Dec-1999 23:58:23, query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"