You can make a HTTP HEAD request in Ruby using the Net::HTTP
module by creating a new instance of Net::HTTP
and calling the head
method on it. Here's an example:
main.rb225 chars11 lines
In this example, we're making a HTTP HEAD request to http://example.com
and printing out the response code, content type, and last modified headers. The Net::HTTP
module automatically handles building the HTTP request and parsing the response headers.
gistlibby LogSnag