Method: Net::HTTP#request_head

Defined in:
lib/net/http.rb

#request_head(path, initheader = nil, &block) ⇒ Object Also known as: head2

Sends a HEAD request to the path and gets a response, as an HTTPResponse object.

Returns the response.

This method never raises Net::* exceptions.

response = http.request_head('/index.html')
p response['content-type']


961
962
963
# File 'lib/net/http.rb', line 961

def request_head(path, initheader = nil, &block)
  request(Head.new(path, initheader), &block)
end