Skip to content

Instantly share code, notes, and snippets.

@breezhang
Created September 2, 2014 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breezhang/cfcbeeeadda48c6cdeed to your computer and use it in GitHub Desktop.
Save breezhang/cfcbeeeadda48c6cdeed to your computer and use it in GitHub Desktop.
ruby Net http lib
require 'net/http'
url = URI.parse('http://localhost:3000/')
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment