Skip to content

Instantly share code, notes, and snippets.

@dbalatero
Created May 22, 2009 15:16
Show Gist options
  • Save dbalatero/116184 to your computer and use it in GitHub Desktop.
Save dbalatero/116184 to your computer and use it in GitHub Desktop.
require 'fakeweb'
FakeWeb.allow_net_connect = false
req = Net::HTTP::Get.new('/index.html')
req.basic_auth("[email protected]", "password")
response = Net::HTTP.start('www.google.com', 80) do |http|
http.request(req)
end
puts response.body
# Note: req.basic_auth('username', 'password')
# will not fail, as there is no @gmail.com at the end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment