Sha256: fed5d0c89e2f97b77df9e00d794816b0ef980d3a510445a88c6b7a6fd84e36f9

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

# frozen_string_literal: true

module ApiProxy
  class HeadersFilter
    def initialize(headers, allowed_headers = [])
      @headers = headers
      @allowed_headers = allowed_headers
    end

    def filter
      @headers.select { |key, value| @allowed_headers.include?(key) && value.present? }
              .transform_values { |value| Array(value)[0] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api_proxy-0.2.9 lib/api_proxy/headers_filter.rb