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