class Gitlab::Request
def authorization_header(options)
-
(Error::MissingCredentials)
- if private_token and auth_token are not set.
Options Hash:
(**options)
-
:unauthenticated
(Boolean
) -- true if the API call does not require user authentication.
Parameters:
-
options
(Hash
) -- A customizable set of options.
def authorization_header(options) return if options[:unauthenticated] raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token options[:headers] = if @private_token.size < 21 { 'PRIVATE-TOKEN' => @private_token } else { 'Authorization' => "Bearer #{@private_token}" } end end