Comparing version
@@ -157,3 +157,3 @@ 'use strict' | ||
} | ||
if (!res.allLogs) { | ||
if (Array.isArray(res.allLogs) === false) { | ||
res.allLogs = [] | ||
@@ -160,0 +160,0 @@ } |
{ | ||
"name": "pino-http", | ||
"version": "10.3.0", | ||
"version": "10.4.0", | ||
"description": "High-speed HTTP logger for Node.js", | ||
@@ -16,7 +16,7 @@ "main": "logger.js", | ||
"@types/node": "^22.0.0", | ||
"autocannon": "^7.3.0", | ||
"autocannon": "^8.0.0", | ||
"coveralls": "^3.0.0", | ||
"http-ndjson": "^3.1.0", | ||
"pino-http-print": "^3.1.0", | ||
"pino-pretty": "^11.0.0", | ||
"pino-pretty": "^13.0.0", | ||
"pre-commit": "^1.1.2", | ||
@@ -28,3 +28,3 @@ "split2": "^4.0.0", | ||
"tsd": "^0.31.0", | ||
"typescript": "^5.0.2" | ||
"typescript": "~5.7.2" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
@@ -131,2 +131,28 @@ 'use strict' | ||
test('req.allLogs is correctly created if it does not exist', function (t) { | ||
const dest = split(JSON.parse) | ||
const logger = pinoHttp(dest) | ||
function handler (req, res) { | ||
delete req.allLogs | ||
logger(req, res) | ||
t.ok(Array.isArray(req.allLogs), 'req.allLogs should be an array') | ||
t.equal(req.allLogs.length, 1, 'req.allLogs should have one logger entry') | ||
t.equal(typeof req.allLogs[0].info, 'function', 'req.allLogs should contain a valid logger instance') | ||
res.end('hello world') | ||
} | ||
setup(t, logger, function (err, server) { | ||
t.error(err) | ||
doGet(server) | ||
}, handler) | ||
dest.on('data', function () { | ||
t.end() | ||
}) | ||
}) | ||
test('when multiple pino middleware are present each pino logger retains its own redact config', function (t) { | ||
@@ -133,0 +159,0 @@ t.plan(6) |
83058
0.83%1973
0.97%0
-100%3
-25%