Compare commits

..

No commits in common. "5bc2949a4932323a736bfdd69c173778a392387b" and "3ec44fd56a50d4508558a983c7b711e8c7f06151" have entirely different histories.

4 changed files with 2 additions and 22 deletions

View File

@ -13,10 +13,6 @@ module HTTPX
def authentication(token)
with(headers: { "authorization" => token })
end
def bearer_auth(token)
authentication("Bearer #{token}")
end
end
end
register_plugin :authentication, Authentication

View File

@ -29,15 +29,12 @@ module HTTPX
attr_reader :state
def initialize(family, options)
def initialize(_, options)
super
@ns_index = 0
@resolver_options = DEFAULTS.merge(@options.resolver_options)
@socket_type = @resolver_options.fetch(:socket_type, :udp)
@nameserver = if (nameserver = @resolver_options[:nameserver])
nameserver = nameserver[family] if nameserver.is_a?(Hash)
Array(nameserver)
end
@nameserver = Array(@resolver_options[:nameserver]) if @resolver_options[:nameserver]
@ndots = @resolver_options[:ndots]
@search = Array(@resolver_options[:search]).map { |srch| srch.scan(/[^.]+/) }
@_timeouts = Array(@resolver_options[:timeouts])

View File

@ -3,8 +3,6 @@ module HTTPX
module Authentication
module InstanceMethods
def authentication: (string token) -> instance
def bearer_auth: (string token) -> instance
end
end

View File

@ -3,17 +3,6 @@
module Requests
module Plugins
module Authentication
# Bearer Auth
def test_plugin_bearer_auth
get_uri = build_uri("/get")
session = HTTPX.plugin(:authentication)
response = session.bearer_auth("TOKEN").get(get_uri)
verify_status(response, 200)
body = json_body(response)
verify_header(body["headers"], "Authorization", "Bearer TOKEN")
end
# Basic Auth
def test_plugin_basic_authentication