lib/timber/contexts/http.rb in timber-2.3.4 vs lib/timber/contexts/http.rb in timber-2.4.0
- old
+ new
@@ -13,21 +13,23 @@
# @note This context should be installed automatically through the,
# {Intregrations::Rack::HTTPContext} Rack middleware.
class HTTP < Context
@keyspace = :http
- attr_reader :method, :path, :remote_addr, :request_id
+ attr_reader :host, :method, :path, :remote_addr, :request_id
def initialize(attributes)
+ @host = attributes[:host]
@method = attributes[:method] || raise(ArgumentError.new(":method is required"))
- @path = attributes[:path] || raise(ArgumentError.new(":path is required"))
+ @path = attributes[:path]
@remote_addr = attributes[:remote_addr]
@request_id = attributes[:request_id]
end
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
def as_json(_options = {})
- {:method => method, :path => path, :remote_addr => remote_addr, :request_id => request_id}
+ {:host => host, :method => method, :path => path, :remote_addr => remote_addr,
+ :request_id => request_id}
end
end
end
end
\ No newline at end of file