Sha256: f5940342eb9ee3bd0e2708778b5f71b2c70a112f7a77bd9702ac04796bc9e522

Contents?: true

Size: 362 Bytes

Versions: 3

Compression:

Stored size: 362 Bytes

Contents

require 'base64'

module Faraday
  class Request::BasicAuthentication < Faraday::Middleware
    def initialize(app, login, pass)
      super(app)
      @header_value = "Basic #{Base64.encode64([login, pass].join(':')).gsub("\n", '')}"
    end

    def call(env)
      env[:request_headers]['Authorization'] = @header_value
      @app.call(env)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evrythng-0.0.5 lib/faraday/request/basic_authentication.rb
evrythng-0.0.3 lib/faraday/request/basic_authentication.rb
evrythng-0.0.2 lib/faraday/request/basic_authentication.rb