Method: HTTPClient::BasicAuth#get

Defined in:
lib/httpclient.rb

#get(req) ⇒ Object

send cred only when a given uri is;

- child page of challengeable(got WWW-Authenticate before) uri and,
- child page of defined credential


421
422
423
424
425
426
427
428
429
430
# File 'lib/httpclient.rb', line 421

def get(req)
  target_uri = req.header.request_uri
  return nil unless @challengeable.find { |uri, ok|
    Util.uri_part_of(target_uri, uri) and ok
  }
  return @cred if @cred
  Util.hash_find_value(@auth) { |uri, cred|
    Util.uri_part_of(target_uri, uri)
  }
end