Comparing version 2.4.0 to 2.4.1
@@ -27,3 +27,3 @@ 'use strict' | ||
function onResFinished (err, msg) { | ||
function onResFinished (err) { | ||
this.removeListener('finish', onResFinished) | ||
@@ -47,3 +47,3 @@ this.removeListener('error', onResFinished) | ||
responseTime: responseTime | ||
}, 'request ' + (msg || 'completed')) | ||
}, 'request completed') | ||
} | ||
@@ -53,11 +53,4 @@ | ||
var res = this.res | ||
onResFinished.call(res, null, 'aborted') | ||
} | ||
function onReqTimeout () { | ||
this.removeListener('aborted', onReqAborted) | ||
var res = this.res | ||
res.statusCode = 408 | ||
onResFinished.call(res, new Error('Timeout')) | ||
onResFinished.call(res, new Error('Aborted')) | ||
} | ||
@@ -73,4 +66,4 @@ | ||
res.on('error', onResFinished) | ||
// it's possible that browser aborts connection, or http-server because of timeout | ||
req.on('aborted', onReqAborted) | ||
req.socket.on('timeout', onReqTimeout.bind(req)) | ||
@@ -77,0 +70,0 @@ if (next) { |
{ | ||
"name": "pino-http", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "High-speed HTTP logger for Node.js", | ||
"main": "logger.js", | ||
"dependencies": { | ||
"pino": "^3.3.2" | ||
"pino": "^3.0.1" | ||
}, | ||
@@ -9,0 +9,0 @@ "devDependencies": { |
@@ -294,3 +294,5 @@ 'use strict' | ||
dest.on('data', function (line) { | ||
t.equal(line.msg, 'request aborted', 'message is set') | ||
t.equal(line.msg, 'request errored', 'message is set') | ||
t.equal(line.err.message, 'Aborted', 'error message is set') | ||
t.equal(line.res.statusCode, 408, 'statusCode is 408') | ||
t.end() | ||
@@ -300,3 +302,3 @@ }) | ||
test('react on timeout event from server', function (t) { | ||
test('react on aborted event from server', function (t) { | ||
var dest = split(JSON.parse) | ||
@@ -328,3 +330,3 @@ | ||
t.equal(line.msg, 'request errored', 'message is set') | ||
t.equal(line.err.message, 'Timeout', 'error message is set') | ||
t.equal(line.err.message, 'Aborted', 'error message is set') | ||
t.equal(line.res.statusCode, 408, 'statusCode is 408') | ||
@@ -331,0 +333,0 @@ t.end() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20566
442
Updatedpino@^3.0.1