End of Life Ruby 3.1 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.1.3/lib/net/http.rb, line 1487
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']
See also
#request_get
#request_post
#request
#response_body_encoding=
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0