Sha256: c45507f621ccc8d3bfe6fbcdc25f9a53a1ad5b4de46c2352861d9741239d43ec

Contents?: true

Size: 390 Bytes

Versions: 13

Compression:

Stored size: 390 Bytes

Contents

require 'faraday'

module Faraday
  class Request::BasicAuth < Faraday::Middleware
    require 'base64'

    def call(env)
      header = Base64.encode64("#{@options[:username]}:#{@options[:password]}")
      env[:request_headers]['Authorization'] = "Basic #{header.to_s}"
      @app.call(env)
    end

    def initialize(app, options)
      @app, @options = app, options
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
cashstar-ruby-0.2.4 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.2.3 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.2.2 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.2.1 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.2.0 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.1.8 lib/faraday/request/basic_auth.rb
cashstar-ruby-0.1.7 lib/faraday/request/basic_auth.rb
cashstar-0.1.5 lib/faraday/request/basic_auth.rb
cashstar-0.1.4 lib/faraday/request/basic_auth.rb
cashstar-0.1.3 lib/faraday/request/basic_auth.rb
cashstar-0.1.2 lib/faraday/request/basic_auth.rb
cashstar-0.1.1 lib/faraday/request/basic_auth.rb
cashstar-0.1.0 lib/faraday/request/basic_auth.rb