class RequestId
Captures request id
Public Class Methods
new(app)
click to toggle source
# File lib/sensible_logging/middlewares/request_id.rb, line 7 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/sensible_logging/middlewares/request_id.rb, line 11 def call(env) env['request_id'] = env['HTTP_X_REQUEST_ID'] || new_request_id status, headers, body = @app.call(env) headers['X-Request-Id'] ||= env['request_id'] [status, headers, body] end
Private Instance Methods
new_request_id()
click to toggle source
# File lib/sensible_logging/middlewares/request_id.rb, line 20 def new_request_id SecureRandom.uuid end