Module: Net::HTTPHeader

Included in:
HTTParty::Response::Headers
Defined in:
lib/httparty/net_digest_auth.rb

Defined Under Namespace

Classes: DigestAuthenticator

Instance Method Summary collapse

Instance Method Details

#append_cookies(authenticator) ⇒ Object



19
20
21
22
# File 'lib/httparty/net_digest_auth.rb', line 19

def append_cookies(authenticator)
  cookies = @header['cookie'] ? @header['cookie'] : []
  cookies.concat(authenticator.cookie_header)
end

#digest_auth(username, password, response) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/httparty/net_digest_auth.rb', line 6

def digest_auth(username, password, response)
  authenticator = DigestAuthenticator.new(
    username,
    password,
    @method,
    @path,
    response
  )

  @header['Authorization'] = authenticator.authorization_header
  @header['cookie'] = append_cookies(authenticator) if response['Set-Cookie']
end