Skip to content

Instantly share code, notes, and snippets.

@wasabhi
Created April 8, 2014 10:58
Show Gist options
  • Save wasabhi/10109717 to your computer and use it in GitHub Desktop.
Save wasabhi/10109717 to your computer and use it in GitHub Desktop.
faraday initializer with timeout options
connection = Faraday.new(request_host) do |faraday|
faraday.request :url_encoded
faraday.options[:timeout] = TIMEOUT
faraday.options[:open_timeout] = OPEN_TIMEOUT
faraday.response :logger if ENV['DEBUG']
faraday.adapter Faraday.default_adapter
faraday.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment