Skip to content

Commit a248cc8

Browse files
authored
Correct response code when rate limit is exceeded
429 Rate Limit Exceeded response when there are too many requests.
1 parent 7c22c2a commit a248cc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routes/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function genUser(req, res, version) {
6666
const ip = req.headers['cf-connecting-ip'] || req.headers['x-real-ip'] || req.headers['x-forwarded-for'] || req.connection.remoteAddress;
6767

6868
if (process.env.spec !== "true" && clients[ip] >= settings.limit) {
69-
return res.status(503).json({
69+
return res.status(429).json({
7070
error: `Whoa, ease up there cowboy. You've requested ${clients[ip]} users in the last minute. Help us keep this service free and spare some bandwidth for other users please :)`
7171
});
7272
}
@@ -226,4 +226,4 @@ async function genUser(req, res, version) {
226226
}
227227
}
228228

229-
module.exports = router;
229+
module.exports = router;

0 commit comments

Comments
 (0)