Sha256: 8545fc888e41720b907a342640e54391bcc8d07dfd42bc0a863e1b89542e78b8
Contents?: true
Size: 456 Bytes
Versions: 7
Compression:
Stored size: 456 Bytes
Contents
# frozen_string_literal: true module FinAppsCore module Middleware # Adds a header to specify tenant to retrieve data for class XTenantId < Faraday::Middleware KEY = 'X-Tenant-ID' unless defined? KEY def initialize(app, x_tenant_id) super(app) @x_tenant_id = x_tenant_id.to_s.strip end def call(env) env[:request_headers][KEY] ||= @x_tenant_id @app.call(env) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems