Sha256: f0f4b7a1e015602b575a38d6609441d19009563a1235c4fbdc1cc35a3afcf2e5
Contents?: true
Size: 553 Bytes
Versions: 3
Compression:
Stored size: 553 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("#{URI.escape(user)}:#{URI.escape(password)}")}") end alias_method :basic_auth, :basic_authentication end end register_plugin :basic_authentication, BasicAuthentication end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
httpx-0.3.1 | lib/httpx/plugins/basic_authentication.rb |
httpx-0.3.0 | lib/httpx/plugins/basic_authentication.rb |
httpx-0.2.1 | lib/httpx/plugins/basic_authentication.rb |