Skip to content

best way to save what you love

api/core: return 429 http status for rate-limit (#1066)

lostdustyfa267ae54b83
diff --git a/api/src/core/api.js b/api/src/core/api.js
index 364764c0..84f814e4 100644
--- a/api/src/core/api.js
+++ b/api/src/core/api.js
@@ -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');