Method: HTTPClient::WWWAuth#filter_request

Defined in:
lib/httpclient/auth.rb

#filter_request(req) ⇒ Object

Filter API implementation. Traps HTTP request and insert ‘Authorization’ header if needed.



111
112
113
114
115
116
117
118
119
# File 'lib/httpclient/auth.rb', line 111

def filter_request(req)
  @authenticator.each do |auth|
    next unless auth.set? # hasn't be set, don't use it
    if cred = auth.get(req)
      req.header.set('Authorization', auth.scheme + " " + cred)
      return
    end
  end
end