Module: Spectre::Http::BasicAuth

Defined in:
lib/spectre/http/basic_auth.rb

Class Method Summary collapse

Class Method Details

.on_req(_http, net_req, req) ⇒ Object



16
17
18
19
20
21
# File 'lib/spectre/http/basic_auth.rb', line 16

def self.on_req _http, net_req, req
  return unless req.key? 'basic_auth' and req['auth'] == 'basic_auth'

  basic_auth_cfg = req['basic_auth']
  net_req.basic_auth(basic_auth_cfg['username'], basic_auth_cfg['password'])
end