Skip to content

Commit

Permalink
allow handler to access options
Browse files Browse the repository at this point in the history
  • Loading branch information
takeshirs committed Jul 22, 2021
1 parent c4f9c46 commit 0dfd0be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/express-rate-limit.js
Expand Up @@ -23,7 +23,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 @@ -152,7 +152,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 0dfd0be

Please sign in to comment.