Created
February 27, 2015 15:58
-
-
Save jschairb/2fd60bbb28cfd1cfc401 to your computer and use it in GitHub Desktop.
Setting request options for all requests from a Faraday client
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
require 'faraday' | |
require 'patron' | |
request_url = 'https://example.com' | |
options = { | |
:headers => { | |
"Accept" => "application/json" | |
}, | |
:request => { | |
:timeout => 10, | |
:open_timeout => 10 | |
} | |
} | |
connection = Faraday.new(request_url, options) do |builder| | |
builder.adapter :patron | |
end | |
puts connection.options.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment