Class: Infrataster::FaradayMiddlewares::FollowRedirects

Inherits:
FaradayMiddleware::FollowRedirects
  • Object
show all
Defined in:
lib/infrataster/faraday_middlewares/follow_redirects.rb

Instance Method Summary collapse

Instance Method Details

#update_env(env, request_body, response) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/infrataster/faraday_middlewares/follow_redirects.rb', line 6

def update_env(env, request_body, response)
  super.tap do |e|
    if replacement = @options[:host_mapping][e[:url].hostname]
      e[:request_headers]['Host'] = e[:url].hostname
      e[:url].hostname = replacement
    end
  end
end