Sha256: 57bc91df1e1da9f62ab7a6ed60eb03b78fe61dd82231ca541ddc442271446adb

Contents?: true

Size: 529 Bytes

Versions: 7

Compression:

Stored size: 529 Bytes

Contents

# frozen_string_literal: true

module HTTPX
  module Plugins
    module BasicAuthentication
      def self.load_dependencies(klass, *)
        require "base64"
        klass.plugin(:authentication)
      end

      module InstanceMethods
        def basic_authentication(user, password)
          authentication("Basic #{Base64.strict_encode64("#{user}:#{password}")}")
        end
        alias_method :basic_auth, :basic_authentication
      end
    end
    register_plugin :basic_authentication, BasicAuthentication
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
httpx-0.2.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.1.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.0.5 lib/httpx/plugins/basic_authentication.rb
httpx-0.0.4 lib/httpx/plugins/basic_authentication.rb
httpx-0.0.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.0.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.0.1 lib/httpx/plugins/basic_authentication.rb