diff --git a/lib/dfe/analytics/event.rb b/lib/dfe/analytics/event.rb index d3534ba8..a34394f6 100644 --- a/lib/dfe/analytics/event.rb +++ b/lib/dfe/analytics/event.rb @@ -36,7 +36,7 @@ def with_request_details(rack_request) request_uuid: rack_request.uuid, request_user_agent: ensure_utf8(rack_request.user_agent), request_method: rack_request.method, - request_path: ensure_utf8(rack_request.path), + request_path: ensure_utf8(rack_request.original_fullpath.split('?').first), request_query: hash_to_kv_pairs(Rack::Utils.parse_query(rack_request.query_string)), request_referer: ensure_utf8(rack_request.referer), anonymised_user_agent_and_ip: anonymised_user_agent_and_ip(rack_request) diff --git a/spec/dfe/analytics/event_spec.rb b/spec/dfe/analytics/event_spec.rb index 1e57e9dd..d5b7b740 100644 --- a/spec/dfe/analytics/event_spec.rb +++ b/spec/dfe/analytics/event_spec.rb @@ -14,8 +14,8 @@ 'request_uuid' => '123', 'request_user_agent' => 'SomeClient', 'request_method' => 'GET', - 'request_path' => '/', - 'request_query' => [], + 'request_path' => '/path', + 'request_query' => [{ 'key' => 'a', 'value' => ['b'] }], 'request_referer' => nil }) end @@ -213,8 +213,8 @@ def fake_request(overrides = {}) attrs = { uuid: '123', method: 'GET', - path: '/', - query_string: '', + original_fullpath: '/path?a=b', + query_string: 'a=b', referer: nil, user_agent: 'SomeClient', remote_ip: '1.2.3.4'