class Faraday::Request::Authorization
Request
middleware for the Authorization
HTTP header
Constants
- KEY
Public Class Methods
@param app [#call] @param type [String, Symbol] Type of Authorization
@param params [Array<String, Proc, call
>] parameters to build the Authorization
header.
If the type is `:basic`, then these can be a login and password pair. Otherwise, a single value is expected that will be appended after the type. This value can be a proc or an object responding to `.call`, in which case it will be invoked on each request.
Calls superclass method
Faraday::Middleware::new
# File lib/faraday/request/authorization.rb, line 16 def initialize(app, type, *params) @type = type @params = params super(app) end
Public Instance Methods
@param env [Faraday::Env]
# File lib/faraday/request/authorization.rb, line 23 def on_request(env) return if env.request_headers[KEY] env.request_headers[KEY] = header_from(@type, env, *@params) end