mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature: cloudcmd: ratelimit: X-Forwarded-For (#437)
This commit is contained in:
parent
cad5e0f44e
commit
40ecef5ec4
7 changed files with 61 additions and 31 deletions
|
|
@ -1,22 +0,0 @@
|
|||
import process from 'node:process';
|
||||
import {test} from 'supertape';
|
||||
|
||||
test('cloudcmd: server: ratelimit', async (t) => {
|
||||
const PORT = 3000;
|
||||
const STATUS = 429;
|
||||
|
||||
process.env.PORT = PORT;
|
||||
process.env.CLOUDCMD_LOG = 0;
|
||||
|
||||
await import('../../bin/cloudcmd.js');
|
||||
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
await fetch(`http://localhost:${PORT}`);
|
||||
}
|
||||
|
||||
const {status} = await fetch(`http://localhost:${PORT}`);
|
||||
process.kill(process.pid, 'SIGUSR1');
|
||||
|
||||
t.equal(status, STATUS);
|
||||
t.end();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue