Class: ILove::Tracing::RequestId::RequestIdRackMiddleware
- Inherits:
-
Object
- Object
- ILove::Tracing::RequestId::RequestIdRackMiddleware
- Defined in:
- lib/ilove/tracing/request_id.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RequestIdRackMiddleware
constructor
A new instance of RequestIdRackMiddleware.
- #rack_header_name ⇒ Object
Constructor Details
#initialize(app) ⇒ RequestIdRackMiddleware
Returns a new instance of RequestIdRackMiddleware.
19 20 21 |
# File 'lib/ilove/tracing/request_id.rb', line 19 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/ilove/tracing/request_id.rb', line 27 def call(env) ILove::Tracing::RequestId.request_id = env[rack_header_name] @app.call(env) ensure ILove::Tracing::RequestId.request_id = nil end |
#rack_header_name ⇒ Object
23 24 25 |
# File 'lib/ilove/tracing/request_id.rb', line 23 def rack_header_name @@rack_header_name ||= 'HTTP_' + ILove::Tracing::RequestId.cfg.request_id_header.gsub(/-/, '_').upcase end |