Skip to content

Commit

Permalink
Merge pull request #245 from takeshirs/feature/handler-options
Browse files Browse the repository at this point in the history
allow handler to access options

fixes #214
  • Loading branch information
nfriedly committed Oct 12, 2021
2 parents 67d365f + 0dfd0be commit 5cf1129
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/express-rate-limit.js
Expand Up @@ -28,7 +28,7 @@ function RateLimit(options) {
skip: function (/*req, res*/) {
return false;
},
handler: function (req, res /*, next*/) {
handler: function (req, res /*, next, optionsUsed*/) {
res.status(options.statusCode).send(options.message);
},
onLimitReached: function (/*req, res, optionsUsed*/) {},
Expand Down Expand Up @@ -164,7 +164,7 @@ function RateLimit(options) {
Math.ceil(options.windowMs / 1000)
);
}
return options.handler(req, res, next);
return options.handler(req, res, next, options);
}

next();
Expand Down

0 comments on commit 5cf1129

Please sign in to comment.