Class: Chronatog::Client::Connection::BasicAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/chronatog/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, creds) ⇒ BasicAuth

Returns a new instance of BasicAuth.



113
114
115
116
# File 'lib/chronatog/client.rb', line 113

def initialize(app, creds)
  @app = app
  @username, @password = creds
end

Instance Method Details

#call(env) ⇒ Object



118
119
120
121
# File 'lib/chronatog/client.rb', line 118

def call(env)
  env["HTTP_AUTHORIZATION"] = 'Basic ' + ["#{@username}:#{@password}"].pack('m').delete("\r\n")
  @app.call(env)
end