Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
✨ Add X-RateLimit-Limit-Type header
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Jun 4, 2019
1 parent 2297994 commit 6a2dbbd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/helpers/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ export const rateLimitHandler = async (
if (apiKey) {
const apiKeyDetails = await getApiKey(apiKey);
if (apiKeyDetails.userId) {
res.setHeader("X-RateLimit-Limit-Type", "api-key");
return rateLimiter(req, res, next);
}
}
res.setHeader("X-RateLimit-Limit-Type", "public");
return publicRateLimiter(req, res, next);
};

Expand Down

0 comments on commit 6a2dbbd

Please sign in to comment.