Module: HTTPX::Plugins::FollowRedirects::OptionsMethods
- Defined in:
- lib/httpx/plugins/follow_redirects.rb
Overview
adds support for the following options:
- :max_redirects
-
max number of times a request will be redirected (defaults to
3
). - :follow_insecure_redirects
-
whether redirects to an “http://” URI, when coming from an “https//”, are allowed (defaults to
false
). - :allow_auth_to_other_origins
-
whether auth-related headers, such as “Authorization”, are propagated on redirection (defaults to
false
). - :redirect_on
-
optional callback which receives the redirect location and can halt the redirect chain if it returns
false
.
Instance Method Summary collapse
- #option_allow_auth_to_other_origins(value) ⇒ Object
- #option_follow_insecure_redirects(value) ⇒ Object
- #option_max_redirects(value) ⇒ Object
- #option_redirect_on(value) ⇒ Object
Instance Method Details
#option_allow_auth_to_other_origins(value) ⇒ Object
48 49 50 |
# File 'lib/httpx/plugins/follow_redirects.rb', line 48 def option_allow_auth_to_other_origins(value) value end |
#option_follow_insecure_redirects(value) ⇒ Object
44 45 46 |
# File 'lib/httpx/plugins/follow_redirects.rb', line 44 def option_follow_insecure_redirects(value) value end |
#option_max_redirects(value) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/httpx/plugins/follow_redirects.rb', line 37 def option_max_redirects(value) num = Integer(value) raise TypeError, ":max_redirects must be positive" if num.negative? num end |
#option_redirect_on(value) ⇒ Object
52 53 54 55 56 |
# File 'lib/httpx/plugins/follow_redirects.rb', line 52 def option_redirect_on(value) raise TypeError, ":redirect_on must be callable" unless value.respond_to?(:call) value end |