Module: HTTPX::Plugins::Auth::OptionsMethods

Defined in:
lib/httpx/plugins/auth.rb

Overview

adds support for the following options:

:auth_header_value

the token to use as a string, or a callable which returns a string when called.

:auth_header_type

the authentication type to use in the “authorization” header value (i.e. “Bearer”, “Digest”…)

:generate_auth_value_on_retry

callable which returns whether the request should regenerate the auth_header_value when the request is retried (this option will only work if the session also loads the :retries plugin).

Instance Method Summary collapse

Instance Method Details

#option_auth_header_type(value) ⇒ Object



31
32
33
# File 'lib/httpx/plugins/auth.rb', line 31

def option_auth_header_type(value)
  value
end

#option_auth_header_value(value) ⇒ Object



27
28
29
# File 'lib/httpx/plugins/auth.rb', line 27

def option_auth_header_value(value)
  value
end

#option_generate_auth_value_on_retry(value) ⇒ Object

Raises:

  • (TypeError)


35
36
37
38
39
# File 'lib/httpx/plugins/auth.rb', line 35

def option_generate_auth_value_on_retry(value)
  raise TypeError, "`:generate_auth_value_on_retry` must be a callable" unless value.respond_to?(:call)

  value
end