Skip to content

Instantly share code, notes, and snippets.

@huned
Created June 11, 2009 22:25
Show Gist options
  • Save huned/128273 to your computer and use it in GitHub Desktop.
Save huned/128273 to your computer and use it in GitHub Desktop.
# monkey patch HTTParty to use a configurable timeout
module HTTParty
class Request
private
def http
http = Net::HTTP.new(uri.host, uri.port, options[:http_proxyaddr], options[:http_proxyport])
http.use_ssl = (uri.port == 443)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.open_timeout = http.read_timeout = options[:timeout].to_i if options[:timeout].to_i > 0
http
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment