mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 01:18:27 +00:00
api/core: return 429 http status for rate-limit (#1066)
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Co-authored-by: jj <log@riseup.net>
This commit is contained in:
parent
ad23b70e9d
commit
fa267ae54b
@ -61,13 +61,13 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
})
|
||||
|
||||
const handleRateExceeded = (_, res) => {
|
||||
const { status, body } = createResponse("error", {
|
||||
const { body } = createResponse("error", {
|
||||
code: "error.api.rate_exceeded",
|
||||
context: {
|
||||
limit: env.rateLimitWindow
|
||||
}
|
||||
});
|
||||
return res.status(status).json(body);
|
||||
return res.status(429).json(body);
|
||||
};
|
||||
|
||||
const keyGenerator = (req) => hashHmac(getIP(req), 'rate').toString('base64url');
|
||||
|
Loading…
Reference in New Issue
Block a user