I'm looking at the documentation:
http://ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html

And I notice two uses of Net::HTTP. Both are using GET requests. But
what's the difference? When to use which?

Net::HTTP.start(uri.host, uri.port) do |http|
  request = Net::HTTP::Get.new uri

  response = http.request request # Net::HTTPResponse object
end



uri = URI('http://example.com/index.html')
res = Net::HTTP.get_response(uri)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to