diff --git a/.nvmrc b/.nvmrc index f599e28..48082f7 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -10 +12 diff --git a/.travis.yml b/.travis.yml index 89a0c5b..d6aa975 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: node_js node_js: - lts/* - node - - 10 before_script: - npm install diff --git a/LICENSE b/LICENSE index 7c96c65..de0e1fe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2017 Felix Heck +Copyright (c) 2017-2020 Felix Heck Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e94c78c..fa3d398 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ The modules [`standard`](https://standardjs.com/) and [`ava`](https://github.com #### Compatibility | Major Release | [hapi.js](https://github.com/hapijs/hapi) version | [hapi-pino](https://github.com/pinojs/hapi-pino) version | node version | | --- | --- | --- | --- | +| `v6` | `>=18.4 @hapi/hapi` | `>= 6.3` | `>=12` | | `v5.1` | `>=18.3.1 @hapi/hapi` | `>= 5.4` | `>=8` | | `v5` | `>=18 hapi` | `>= 5.4` | `>=8` | | `v4` | `>=17 hapi` | `>= 5.1` | `>=8` | diff --git a/package.json b/package.json index 315fb39..df5a792 100644 --- a/package.json +++ b/package.json @@ -41,23 +41,23 @@ }, "devDependencies": { "@hapi/hapi": "^18.4.0", - "ava": "^2.2.0", - "coveralls": "^3.0.5", + "ava": "^2.4.0", + "coveralls": "^3.0.9", "fixture-stdout": "^0.2.1", "nyc": "^15.0.0", - "standard": "^14.3.0" + "standard": "^14.3.1" }, "dependencies": { - "@hapi/joi": "^16.1.1", + "@hapi/joi": "^17.0.0", "chalk": "^3.0.0", - "error-stack-parser": "^2.0.2", - "hapi-pino": "^6.0.1", + "error-stack-parser": "^2.0.6", + "hapi-pino": "^6.3.0", "lodash.get": "^4.4.2", "lodash.set": "^4.3.2", - "pino": "^5.13.0" + "pino": "^5.15.0" }, "engines": { - "node": ">= 8.9", - "npm": ">= 5.5.1" + "node": ">= 12", + "npm": ">= 6" } } diff --git a/src/tokens.js b/src/tokens.js index f9387a7..e1669f3 100644 --- a/src/tokens.js +++ b/src/tokens.js @@ -151,7 +151,7 @@ assign('remotePort', data => ( )) assign('url', data => ( - data.req && data.req.url + data.req && data.req.url && data.req.url.href )) assign('host', (data, colors, field = 'host') => { diff --git a/test/tokens.spec.js b/test/tokens.spec.js index 0e27fb1..9d6d3dc 100644 --- a/test/tokens.spec.js +++ b/test/tokens.spec.js @@ -111,7 +111,9 @@ test('return requested req/res attributes', (t) => { req: { id: '1499781055994:f3lix:67067:j4zmw7av:10000', method: 'get', - url: '/', + url: { + href: '/' + }, remoteAddress: '127.0.0.1', remotePort: 52086, headers: { @@ -126,7 +128,7 @@ test('return requested req/res attributes', (t) => { t.is(tokens.payload(mockData), JSON.stringify({})) t.is(tokens.remoteAddress(mockData), mockData.req.remoteAddress) t.is(tokens.remotePort(mockData), mockData.req.remotePort) - t.is(tokens.url(mockData), mockData.req.url) + t.is(tokens.url(mockData), mockData.req.url.href) t.is(tokens.req(mockData, mockColors, 'x-header'), mockData.req.headers['x-header']) t.is(tokens.res(mockData, mockColors, 'foobar'), 'no-cache') t.is(tokens.res(mockData, mockColors, 'barfoo'), '42')