Class: FinAppsCore::Middleware::XTenantId
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FinAppsCore::Middleware::XTenantId
- Defined in:
- lib/finapps_core/middleware/request/x_tenant_id.rb
Overview
Adds a header to specify tenant to retrieve data for
Constant Summary collapse
- KEY =
'X-Tenant-ID'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, x_tenant_id) ⇒ XTenantId
constructor
A new instance of XTenantId.
Constructor Details
#initialize(app, x_tenant_id) ⇒ XTenantId
Returns a new instance of XTenantId.
9 10 11 12 |
# File 'lib/finapps_core/middleware/request/x_tenant_id.rb', line 9 def initialize(app, x_tenant_id) super(app) @x_tenant_id = x_tenant_id.to_s.strip end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 |
# File 'lib/finapps_core/middleware/request/x_tenant_id.rb', line 14 def call(env) env[:request_headers][KEY] ||= @x_tenant_id @app.call(env) end |