Sha256: 35cbd389cf0ae83f424ba5cd264b90f87c0b19a7e879d46d225b950a9ba1f640
Contents?: true
Size: 816 Bytes
Versions: 5
Compression:
Stored size: 816 Bytes
Contents
require "logtail/contexts/http" require "logtail/current_context" require "logtail-rack/middleware" require "logtail-rack/util/request" module Logtail module Integrations module Rack # A Rack middleware that is reponsible for adding the HTTP context {Logtail::Contexts::HTTP}. class HTTPContext < Middleware def call(env) request = Util::Request.new(env) context = Contexts::HTTP.new( host: request.host.force_encoding('UTF-8'), method: request.request_method.force_encoding('UTF-8'), path: request.path, remote_addr: request.ip.force_encoding('UTF-8'), request_id: request.request_id ) CurrentContext.add(context.to_hash) @app.call(env) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems