adds support for the following options:
:max_retries |
max number of times a request will be retried (defaults to |
:retry_change_requests |
whether idempotent requests are retried (defaults to |
:retry_after |
seconds after which a request is retried; can also be a callable object (i.e. |
:retry_jitter |
number of seconds applied to :retry_after (must be a callable, i.e. |
:retry_on |
callable which alternatively defines a different rule for when a response is to be retried (i.e. |
Methods
Public Instance
Public Instance methods
option_max_retries(value)
[show source]
# File lib/httpx/plugins/retries.rb 72 def option_max_retries(value) 73 num = Integer(value) 74 raise TypeError, ":max_retries must be positive" unless num >= 0 75 76 num 77 end
option_retry_after(value)
[show source]
# File lib/httpx/plugins/retries.rb 55 def option_retry_after(value) 56 # return early if callable 57 unless value.respond_to?(:call) 58 value = Float(value) 59 raise TypeError, ":retry_after must be positive" unless value.positive? 60 end 61 62 value 63 end
option_retry_change_requests(v)
[show source]
# File lib/httpx/plugins/retries.rb 79 def option_retry_change_requests(v) 80 v 81 end
option_retry_jitter(value)
[show source]
# File lib/httpx/plugins/retries.rb 65 def option_retry_jitter(value) 66 # return early if callable 67 raise TypeError, ":retry_jitter must be callable" unless value.respond_to?(:call) 68 69 value 70 end
option_retry_on(value)
[show source]
# File lib/httpx/plugins/retries.rb 83 def option_retry_on(value) 84 raise TypeError, ":retry_on must be called with the response" unless value.respond_to?(:call) 85 86 value 87 end