Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Use query_string
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Mar 1, 2017
1 parent ee5e109 commit 9322f97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/timber/events/http_server_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ module Events
# @note This event should be installed automatically through probes,
# such as the {Probes::ActionControllerLogSubscriber} probe.
class HTTPServerRequest < Timber::Event
attr_reader :host, :method, :path, :port, :query_params, :content_type,
attr_reader :host, :method, :path, :port, :query_string, :content_type,
: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"))
@port = attributes[:port]
@query_params = attributes[:query_params]
@query_string = attributes[:query_string]
@content_type = attributes[:content_type]
@remote_addr = attributes[:remote_addr]
@referrer = attributes[:referrer]
Expand All @@ -23,7 +23,7 @@ def initialize(attributes)
end

def to_hash
{host: host, method: method, path: path, port: port, query_params: query_params,
{host: host, method: method, path: path, port: port, query_string: query_string,
headers: {content_type: content_type, remote_addr: remote_addr, referrer: referrer,
request_id: request_id, scheme: scheme, user_agent: user_agent}}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/timber/probes/rails_rack_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def http_request_event(request)
# No idea why rails 3.X returns a "/" :/
referrer = request.referer == "/" ? nil : request.referer
Events::HTTPServerRequest.new(
content_type: request.content_type,
host: request.host,
method: request.request_method,
path: request.filtered_path,
port: request.port,
query_params: request.GET,
content_type: request.content_type,
query_string: request.query_string,
remote_addr: request.ip,
referrer: referrer,
request_id: request_id(request.env),
Expand Down

0 comments on commit 9322f97

Please sign in to comment.