End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTP#head
head(path, initheader = nil)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/net/http.rb, line 1595
def head(path, initheader = nil)
request(Head.new(path, initheader))
end
Gets only the header from path on the connected-to host. header is a Hash like { ‘Accept’ => ‘/’, … }.
This method returns a Net::HTTPResponse object.
This method never raises an exception.
Example
response = nil Net::HTTP.start('some.www.server', 80) {|http| response = http.head('/index.html') } p response['content-type']