Skip to content

Commit bb42851

Browse files
author
Dom Harrington
committed
Add pageref to be req.route.path
1 parent c84159d commit bb42851

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/construct-payload.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = (req, res, group, options, { startedDateTime }) => ({
1010
creator: { name, version, comment: `${process.platform}/${process.version}` },
1111
entries: [
1212
{
13+
pageref: req.route.path,
1314
startedDateTime: startedDateTime.toISOString(),
1415
time: new Date().getTime() - startedDateTime.getTime(),
1516
request: processRequest(req, options),

test/construct-payload.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ describe('constructPayload()', () => {
5151
assert.equal(body.clientIPAddress, '::ffff:127.0.0.1');
5252
}));
5353

54+
it('#pageref should be `req.route.path`', () =>
55+
request(createApp({}))
56+
.post('/')
57+
.expect(({ body }) => {
58+
assert.equal(body.request.log.entries[0].pageref, '/*');
59+
}));
60+
5461
it('#startedDateTime', () => {
5562
const startedDateTime = new Date();
5663

0 commit comments

Comments
 (0)