Sha256: 7ea51383dc29054d92804b0ba235bcbd76127d7ccb03e2c96c03df45e52f5df2
Contents?: true
Size: 624 Bytes
Versions: 13
Compression:
Stored size: 624 Bytes
Contents
# frozen_string_literal: true module HTTPX module Plugins # # This plugin adds a shim +authorization+ method to the session, which will fill # the HTTP Authorization header, and another, +bearer_auth+, which fill the "Bearer " prefix # in its value. # # https://gitlab.com/os85/httpx/wikis/Auth#auth # module Auth module InstanceMethods def authorization(token) with(headers: { "authorization" => token }) end def bearer_auth(token) authorization("Bearer #{token}") end end end register_plugin :auth, Auth end end
Version data entries
13 entries across 13 versions & 1 rubygems