pull/242/head
xwashere 1 year ago
parent 7bd08debe6
commit a833f8c585
No known key found for this signature in database
GPG Key ID: 042F8BFA1B0EF93B

@ -38,7 +38,7 @@ export const setRateLimiter = (group: string, config: EndpointRateLimitConfigura
* creates middleware for rate limiting * creates middleware for rate limiting
*/ */
export const rateLimiterMiddleware = (group: string, config: EndpointRateLimitConfiguration | undefined): (req: Request, res: Response, next: NextFunction) => void => { export const rateLimiterMiddleware = (group: string, config: EndpointRateLimitConfiguration | undefined): (req: Request, res: Response, next: NextFunction) => void => {
if (rateLimiterGroups.has(group)) setRateLimiter(group, config); if (!rateLimiterGroups.has(group)) setRateLimiter(group, config);
return (req, res, next) => { return (req, res, next) => {
return rateLimiterGroups.get(group)!(req, res, next); return rateLimiterGroups.get(group)!(req, res, next);

Loading…
Cancel
Save