JS: Add test for fastify-rate-limit

This commit is contained in:
Asger Feldthaus
2021-12-15 16:18:22 +01:00
parent 615b2ec539
commit 4d85799fc7
2 changed files with 7 additions and 0 deletions

View File

@@ -8,3 +8,4 @@
| tst.js:38:20:38:36 | expensiveHandler4 | This route handler performs $@, but is not rate-limited. | tst.js:17:40:17:83 | connect ... ution') | a database access |
| tst.js:64:25:64:63 | functio ... req); } | This route handler performs $@, but is not rate-limited. | tst.js:64:46:64:60 | verifyUser(req) | authorization |
| tst.js:76:25:76:53 | catchAs ... ndler1) | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
| tst.js:88:24:88:40 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |

View File

@@ -82,3 +82,9 @@ function errorHandler(req, res, next) {
next(makeOAuthError(req, res));
}
express().use(errorHandler); // OK - does not perform authentication
const fastifyApp = require('fastify')();
fastifyApp.get('/foo', expensiveHandler1); // NOT OK
fastifyApp.register(require('fastify-rate-limit'));
fastifyApp.get('/bar', expensiveHandler1); // OK