express-timeout-handler
Advanced tools
Comparing version
15
index.js
@@ -55,7 +55,7 @@ const DEFAULT_DISABLE_LIST = [ | ||
} | ||
var disableList = opts.disable || DEFAULT_DISABLE_LIST; | ||
const disableList = opts.disable || DEFAULT_DISABLE_LIST; | ||
return function(req, res, next) { | ||
var start = Date.now(); | ||
var timeoutSocket = null; | ||
const start = Date.now(); | ||
let timeoutSocket = null; | ||
@@ -75,3 +75,3 @@ opts.timeout && req.connection.setTimeout(opts.timeout); | ||
disableList.forEach( method => { | ||
res[method] = accessAttempt.bind(null, method); | ||
res[method] = accessAttempt.bind(res, method); | ||
}); | ||
@@ -87,6 +87,6 @@ } | ||
if (opts.onDelayedResponse) { | ||
var requestTime = Date.now() - start; | ||
var method = `res.${arguments[0]}`; | ||
const requestTime = Date.now() - start; | ||
const method = `res.${arguments[0]}`; | ||
delete arguments[0]; | ||
var args = Object.keys(arguments).reduce((memo, key, index) => { | ||
const args = Object.keys(arguments).reduce((memo, key, index) => { | ||
memo[index] = arguments[key]; | ||
@@ -98,2 +98,3 @@ return memo; | ||
} | ||
return this; | ||
} | ||
@@ -100,0 +101,0 @@ |
{ | ||
"name": "express-timeout-handler", | ||
"version": "2.2.0", | ||
"version": "2.2.2", | ||
"description": "Express timeout middleware that ensures a response is returned to the client on a timeout event.", | ||
@@ -23,11 +23,14 @@ "main": "index.js", | ||
"chai": "3.5.0", | ||
"coveralls": "2.11.11", | ||
"coveralls": "3.0.9", | ||
"express": "4.17.1", | ||
"istanbul": "0.4.5", | ||
"jscs": "3.0.7", | ||
"mocha": "2.5.3", | ||
"mocha-eslint": "2.1.1", | ||
"mocha": "6.1.4", | ||
"mocha-eslint": "4.1.0", | ||
"mocha-jscs": "5.0.1", | ||
"request": "2.88.0" | ||
}, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6841
1.56%5
25%93
1.09%