Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. 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