Class: Kiev::Rack::RequestId
- Inherits:
-
Object
- Object
- Kiev::Rack::RequestId
- Defined in:
- lib/kiev/rack/request_id.rb
Constant Summary collapse
- RAILS_REQUEST_ID =
for Rails 4
"action_dispatch.request_id"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RequestId
constructor
A new instance of RequestId.
Constructor Details
#initialize(app) ⇒ RequestId
11 12 13 |
# File 'lib/kiev/rack/request_id.rb', line 11 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kiev/rack/request_id.rb', line 15 def call(env) request_id_header_out = to_rack(:request_id) request_id_header_in = to_http(:request_id) request_id = make_request_id(env[RAILS_REQUEST_ID] || env[request_id_header_in]) RequestStore.store[:request_id] = request_id RequestStore.store[:request_depth] = request_depth(env) RequestStore.store[:tree_path] = tree_path(env) @app.call(env).tap { |_status, headers, _body| headers[request_id_header_out] = request_id } end |