-
-
Save nuke99/332f43df4d87a87881e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def execute(url,port, options = {}) | |
options = { :parameters => {}, :debug => false, | |
:http_timeout => 60, :method => :get, | |
:headers => {}, :redirect_count => 0, | |
:max_redirects => 10 }.merge(options) | |
....... | |
request = case options[:method] | |
when :post | |
request = Net::HTTP::Post.new(url.request_uri) | |
request.set_form_data(options[:parameters]) | |
request | |
else | |
Net::HTTP::Get.new(url.request_uri) | |
end | |
...... | |
response = execute(url, options) | |
end | |
response | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment