Skip to content

Instantly share code, notes, and snippets.

@aribeiro
Forked from oleander/gist:1263189
Created February 13, 2014 02:02
Show Gist options
  • Save aribeiro/8968409 to your computer and use it in GitHub Desktop.
Save aribeiro/8968409 to your computer and use it in GitHub Desktop.
require "rest-client"
begin
exists = RestClient.head("http://google.com").code == 200
rescue RestClient::Exception => error
exists = (error.http_code != 404)
end
puts "exists=#{exists}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment