lib/timber/events/http_server_request.rb in timber-1.1.8 vs lib/timber/events/http_server_request.rb in timber-1.1.9
- old
+ new
@@ -2,13 +2,13 @@
module Events
# The HTTP request event tracks incoming HTTP requests.
#
# @note This event should be installed automatically through probes,
# such as the {Probes::ActionControllerLogSubscriber} probe.
- class HTTPRequest < Timber::Event
+ class HTTPServerRequest < Timber::Event
attr_reader :host, :method, :path, :port, :query_params, :content_type,
- :remote_addr, :referrer, :request_id, :user_agent
+ :remote_addr, :referrer, :request_id, :scheme, :user_agent
def initialize(attributes)
@host = attributes[:host] || raise(ArgumentError.new(":host is required"))
@method = attributes[:method] || raise(ArgumentError.new(":method is required"))
@path = attributes[:path] || raise(ArgumentError.new(":path is required"))
@@ -16,16 +16,17 @@
@query_params = attributes[:query_params]
@content_type = attributes[:content_type]
@remote_addr = attributes[:remote_addr]
@referrer = attributes[:referrer]
@request_id = attributes[:request_id]
+ @scheme = attributes[:scheme] || raise(ArgumentError.new(":scheme is required"))
@user_agent = attributes[:user_agent]
end
def to_hash
{host: host, method: method, path: path, port: port, query_params: query_params,
headers: {content_type: content_type, remote_addr: remote_addr, referrer: referrer,
- request_id: request_id, user_agent: user_agent}}
+ request_id: request_id, scheme: scheme, user_agent: user_agent}}
end
alias to_h to_hash
def as_json(_options = {})
{:server_side_app => {:http_server_request => to_hash}}
\ No newline at end of file