Skip to content

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)

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']