Sha256: e5b1394e94b5f28c4507eeeb86dd0d44df0a7aedf8519685b88343215839ac1c

Contents?: true

Size: 743 Bytes

Versions: 4

Compression:

Stored size: 743 Bytes

Contents

module RestClient
  module Jogger
    module Filters
      class Headers < Base
        DEFAULT_FILTERS = %w[authorization].freeze

        def filter
          filtered_keys = string_filters
          data.each_with_object({}) do |(key, value), memo|
            if filtered_keys.include?(key.to_s.downcase)
              memo[key] = filter_replacement
            else
              memo[key] = value
            end
          end
        end

        private

        def string_filters
          DEFAULT_FILTERS | normalized_filters
        end

        def normalized_filters
          filters
            .select { |e| e.is_a?(Symbol) || e.is_a?(String) }
            .map { |e| e.to_s.downcase }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest-client-jogger-1.3.0 lib/rest_client/jogger/filters/headers.rb
rest-client-jogger-1.2.2 lib/rest_client/jogger/filters/headers.rb
rest-client-jogger-1.2.1 lib/rest_client/jogger/filters/headers.rb
rest-client-jogger-1.2.0 lib/rest_client/jogger/filters/headers.rb