Class: Logtail::Integrations::Rack::HTTPContext
- Inherits:
-
Middleware
- Object
- Middleware
- Logtail::Integrations::Rack::HTTPContext
- Defined in:
- lib/logtail-rack/http_context.rb
Overview
A Rack middleware that is reponsible for adding the HTTP context Contexts::HTTP.
Instance Method Summary collapse
Methods inherited from Middleware
enabled=, enabled?, #initialize
Constructor Details
This class inherits a constructor from Logtail::Integrations::Rack::Middleware
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/logtail-rack/http_context.rb', line 12 def call(env) request = Util::Request.new(env) context = Contexts::HTTP.new( host: Util::Encoding.force_utf8_encoding(request.host), method: Util::Encoding.force_utf8_encoding(request.request_method), path: request.path, remote_addr: Util::Encoding.force_utf8_encoding(request.ip), request_id: request.request_id ) CurrentContext.with(context.to_hash) do @app.call(env) end end |