Sha256: efb45a3ee5f5fc9a07db2f5399d7992b2d41b890d9dcf6ec3190dffaa214c56e
Contents?: true
Size: 633 Bytes
Versions: 7
Compression:
Stored size: 633 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#authorization # 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
7 entries across 7 versions & 1 rubygems