Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#key?
(::interned key) -> bool
key?(key)
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/net/http/header.rb, line 481
def key?(key)
@header.key?(key.downcase.to_s)
end
Returns true if the field for the case-insensitive key exists, false otherwise:
Example
req = Net::HTTP::Get.new(uri) req.key?('Accept') # => true req.key?('Nosuch') # => false
See also
#get_fields
#main_type
#form_data=
#proxy_basic_auth
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0