Sha256: 01ae1abffc975c6e0744f77b2e6eb33b6f420447319b9fcae07975af1781cc26
Contents?: true
Size: 470 Bytes
Versions: 12
Compression:
Stored size: 470 Bytes
Contents
# frozen_string_literal: true module FinAppsCore module Middleware # Adds a header to specify consumer to retrieve data for class XConsumerId < Faraday::Middleware KEY = 'X-Consumer-ID' unless defined? KEY def initialize(app, x_consumer_id) super(app) @x_consumer_id = x_consumer_id.to_s.strip end def call(env) env[:request_headers][KEY] ||= @x_consumer_id @app.call(env) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems