Skip to content

Commit

Permalink
Merge pull request #112 from DFE-Digital/full-path
Browse files Browse the repository at this point in the history
Use original_fullpath for request path
  • Loading branch information
thomasleese authored Feb 21, 2024
2 parents dc34900 + c5dd549 commit 735932a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/dfe/analytics/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions spec/dfe/analytics/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 735932a

Please sign in to comment.