express-rate-limit 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/express-rate-limit.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -187,14 +187,14 @@ function (req /*, res*/) {
|
|
|
187
187
|
|
|
188
188
|
### handler
|
|
189
189
|
|
|
190
|
-
The function to handle requests once the max limit is exceeded. It receives the request and the response objects. The "next" param is available if you need to pass to the next middleware.
|
|
190
|
+
The function to handle requests once the max limit is exceeded. It receives the request and the response objects. The "next" param is available if you need to pass to the next middleware. Finally, the options param has all of the options that originally passed in when creating the current limiter and the default values for other options.
|
|
191
191
|
|
|
192
192
|
The`req.rateLimit` object has `limit`, `current`, and `remaining` number of requests and, if the store provides it, a `resetTime` Date object.
|
|
193
193
|
|
|
194
194
|
Defaults to:
|
|
195
195
|
|
|
196
196
|
```js
|
|
197
|
-
function (req, res,
|
|
197
|
+
function (req, res, next, options) {
|
|
198
198
|
res.status(options.statusCode).send(options.message);
|
|
199
199
|
}
|
|
200
200
|
```
|
|
@@ -28,7 +28,7 @@ function RateLimit(options) {
|
|
|
28
28
|
skip: function (/*req, res*/) {
|
|
29
29
|
return false;
|
|
30
30
|
},
|
|
31
|
-
handler: function (req, res /*, next*/) {
|
|
31
|
+
handler: function (req, res /*, next, optionsUsed*/) {
|
|
32
32
|
res.status(options.statusCode).send(options.message);
|
|
33
33
|
},
|
|
34
34
|
onLimitReached: function (/*req, res, optionsUsed*/) {},
|
|
@@ -164,7 +164,7 @@ function RateLimit(options) {
|
|
|
164
164
|
Math.ceil(options.windowMs / 1000)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
return options.handler(req, res, next);
|
|
167
|
+
return options.handler(req, res, next, options);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
next();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-rate-limit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
|
|
5
5
|
"homepage": "https://github.com/nfriedly/express-rate-limit",
|
|
6
6
|
"author": {
|