module HTTPX::Plugins::FollowRedirects

  1. lib/httpx/plugins/follow_redirects.rb

This plugin adds support for following redirect (status 30X) responses.

It has an upper bound of followed redirects (see MAX_REDIRECTS), after which it will return the last redirect response. It will *not* raise an exception.

It also doesn't follow insecure redirects (https -> http) by default (see follow_insecure_redirects).

gitlab.com/honeyryderchuck/httpx/wikis/Follow-Redirects

Methods

Public Class

  1. extra_options

Constants

MAX_REDIRECTS = 3  
REDIRECT_STATUS = (300..399).freeze  

Public Class methods

extra_options (options)
[show source]
   # File lib/httpx/plugins/follow_redirects.rb
20 def self.extra_options(options)
21   Class.new(options.class) do
22     def_option(:max_redirects) do |num|
23       num = Integer(num)
24       raise Error, ":max_redirects must be positive" unless num.positive?
25 
26       num
27     end
28 
29     def_option(:follow_insecure_redirects)
30   end.new(options)
31 end