Skip to content

Instantly share code, notes, and snippets.

@oleander
Created October 4, 2011 23:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oleander/1263189 to your computer and use it in GitHub Desktop.
Save oleander/1263189 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