New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default request timeout value? #417
Comments
Any option that can be edited per request can also be set on the Connection instance that you can use to make all your requests. conn = Faraday.new("https://api.example.com", request: {
open_timeout: 2, # opening a connection
timeout: 5 # waiting for response
})
conn.get(...) |
Perfect, thanks! |
Since I see very few correct mentions of this elsewhere, the builder version of this in 0.9.2 is this, with the options attribute being the request option defaults: Faraday::Connection.new('https://api.example.com') do |builder|
builder.options[:open_timeout] = 2
builder.options[:timeout] = 5
builder.adapter Faraday.default_adapter
end |
Both examples explain how to set per request, How I can set globally? |
@neohunter the example above will set it for each request done from that connection. Faraday doesn't currently support a global setting for all connections, but that shouldn't really be necessary as the number of connections you manage should be just a few (actually, only one in most cases). |
Rather than setting a timeout per request, is it possible to set a default across all connections opened within a session?
The text was updated successfully, but these errors were encountered: