Skip to content

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

instance method

Net::HTTPHeader#delete

delete(key)

Removes the header for the given case-insensitive key (see Fields); returns the deleted value, or nil if no such field exists:

Example
req = Net::HTTP::Get.new(uri)
req.delete('Accept') # => ["*/*"]
req.delete('Nosuch') # => nil