End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTP#request_head
request_head(path, initheader = nil, &block)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/net/http.rb, line 1435
def request_head(path, initheader = nil, &block)
request(Head.new(path, initheader), &block)
end
Sends a HEAD request to the path and returns the response as a Net::HTTPResponse object.
Returns the response.
This method never raises Net::* exceptions.
Example
response = http.request_head('/index.html') p response['content-type']