Skip to content

Instantly share code, notes, and snippets.

@joshcutler
Created May 18, 2010 21:32
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 joshcutler/405600 to your computer and use it in GitHub Desktop.
Save joshcutler/405600 to your computer and use it in GitHub Desktop.
Debug Ruby HTTP connections
# DEBUG HTTP Connection
class ActiveResource::Connection
# Creates new Net::HTTP instance for communication with
# remote service and resources.
def http
http = Net::HTTP.new(@site.host, @site.port)
http.use_ssl = @site.is_a?(URI::HTTPS)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl
http.read_timeout = @timeout if @timeout
#Here's the addition that allows you to see the output
http.set_debug_output $stderr
return http
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment