Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Net::HTTPHeader#key?

(::interned key) -> bool
key?(key)

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