Created
November 19, 2014 15:03
-
-
Save sapereau83/c5da45c39cb69e73ba18 to your computer and use it in GitHub Desktop.
Ruby Net::HTTP Get header without body from an HTTP request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "net/http" | |
| uri = URI('YOUR URL') | |
| req = Net::HTTP::Head.new(uri) | |
| res = Net::HTTP.start(uri.hostname, uri.port) do |http| | |
| http.request(req) | |
| end | |
| p res # => #<Net::HTTPOK 200 OK readbody=true> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment