Skip to content

Instantly share code, notes, and snippets.

@gramos
Created August 14, 2015 16:27
Show Gist options
  • Save gramos/23202128c61f5f7021a5 to your computer and use it in GitHub Desktop.
Save gramos/23202128c61f5f7021a5 to your computer and use it in GitHub Desktop.
= Net::HTTP#head
(from ruby core)
=== Implementation from HTTP
------------------------------------------------------------------------------
head(path, initheader = nil)
------------------------------------------------------------------------------
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.
response = nil
Net::HTTP.start('some.www.server', 80) {|http|
response = http.head('/index.html')
}
p response['content-type']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment