X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Faviator%2Ffeature%2Ffaraday%2Frequest%2Fauthorization.rb;fp=3rdparty%2Fmodules%2Faviator%2Ffeature%2Ffaraday%2Frequest%2Fauthorization.rb;h=0000000000000000000000000000000000000000;hb=6e1426dc77fb4e5d51f07c187c6f2219431dc31e;hp=43b452880146d2b0924ab03287d4daae73ce4ed1;hpb=87423ba664cd5f2bb462ebadd08b1a90d0fe1c8d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/aviator/feature/faraday/request/authorization.rb b/3rdparty/modules/aviator/feature/faraday/request/authorization.rb deleted file mode 100644 index 43b452880..000000000 --- a/3rdparty/modules/aviator/feature/faraday/request/authorization.rb +++ /dev/null @@ -1,42 +0,0 @@ -module Faraday - class Request::Authorization < Faraday::Middleware - KEY = "Authorization".freeze unless defined? KEY - - # Public - def self.header(type, token) - case token - when String, Symbol - "#{type} #{token}" - when Hash - build_hash(type.to_s, token) - else - raise ArgumentError, "Can't build an Authorization #{type} header from #{token.inspect}" - end - end - - # Internal - def self.build_hash(type, hash) - offset = KEY.size + type.size + 3 - comma = ",\n#{' ' * offset}" - values = [] - hash.each do |key, value| - values << "#{key}=#{value.to_s.inspect}" - end - "#{type} #{values * comma}" - end - - def initialize(app, type, token) - @header_value = self.class.header(type, token) - super(app) - end - - # Public - def call(env) - unless env.request_headers[KEY] - env.request_headers[KEY] = @header_value - end - @app.call(env) - end - end -end -