lib/httpx/plugins/persistent.rb in httpx-0.9.0 vs lib/httpx/plugins/persistent.rb in httpx-0.10.0
- old
+ new
@@ -17,10 +17,15 @@
#
# https://gitlab.com/honeyryderchuck/httpx/wikis/Persistent
#
module Persistent
def self.load_dependencies(klass)
- klass.plugin(:retries, max_retries: 1, retry_change_requests: true)
+ max_retries = if klass.default_options.respond_to?(:max_retries)
+ [klass.default_options.max_retries, 1].max
+ else
+ 1
+ end
+ klass.plugin(:retries, max_retries: max_retries, retry_change_requests: true)
end
def self.extra_options(options)
options.merge(persistent: true)
end