class Timber::Integrations::Rack::HTTPContext

A Rack middleware that is reponsible for adding the HTTP context {Timber::Contexts::HTTP}.

Public Instance Methods

call(env) click to toggle source
# File lib/timber-rack/http_context.rb, line 11
def call(env)
  request = Util::Request.new(env)
  context = Contexts::HTTP.new(
    host: request.host,
    method: request.request_method,
    path: request.path,
    remote_addr: request.ip,
    request_id: request.request_id
  )

  CurrentContext.add(context.to_hash)
  @app.call(env)
end