Class: Rack::RequestId
- Inherits:
-
Object
- Object
- Rack::RequestId
- Defined in:
- lib/d13n/support/request_id.rb
Constant Summary collapse
- X_REQUEST_ID =
"X-Request-Id".freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ RequestId
constructor
A new instance of RequestId.
Constructor Details
#initialize(app, opts = {}) ⇒ RequestId
Returns a new instance of RequestId.
7 8 9 |
# File 'lib/d13n/support/request_id.rb', line 7 def initialize(app, opts = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 |
# File 'lib/d13n/support/request_id.rb', line 11 def call(env) env['HTTP_X_REQUEST_ID'] = make_request_id(env[X_REQUEST_ID]||env['HTTP_X_REQUEST_ID']) @app.call(env).tap {|_status, headers, _body| headers[X_REQUEST_ID] = env['HTTP_X_REQUEST_ID'] } end |