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#fetch
fetch(key, *args) { |key| ... }
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/net/http/header.rb, line 125
def fetch(key, *args, &block) #:yield: +key+
a = @header.fetch(key.downcase.to_s, *args, &block)
a.kind_of?(Array) ? a.join(', ') : a
end
Returns the header field corresponding to the case-insensitive key. Returns the default value args, or the result of the block, or raises an IndexError if there’s no header field named key See Hash#fetch