Skip to content

Instantly share code, notes, and snippets.

@jschairb
Created February 27, 2015 15:58
Show Gist options
  • Save jschairb/2fd60bbb28cfd1cfc401 to your computer and use it in GitHub Desktop.
Save jschairb/2fd60bbb28cfd1cfc401 to your computer and use it in GitHub Desktop.
Setting request options for all requests from a Faraday client
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