Skip to content

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)

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 #send_entity also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1