File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ const globalLimiter = rateLimit({
9494 max : env . GLOBAL_RATE_LIMIT_MAX ,
9595 standardHeaders : true ,
9696 legacyHeaders : false ,
97- skip : req => mute . has ( req . path ) || req . path . startsWith ( "/api-docs" )
97+ skip : req => mute . has ( req . path ) || req . path . startsWith ( "/api-docs" ) ,
98+ handler : ( req , res , next ) => next ( tooManyRequests ( "Too many requests" ) )
9899} ) ;
99100
100101app . use ( globalLimiter ) ;
Original file line number Diff line number Diff line change 11import rateLimit from "express-rate-limit" ;
22import { env } from "../config/env.js" ;
3+ import { tooManyRequests } from "../utils/httpError.js" ;
34
45export const purchaseLimiter = rateLimit ( {
56 windowMs : env . PURCHASE_RATE_LIMIT_WINDOW_MS ,
67 max : env . PURCHASE_RATE_LIMIT_MAX ,
78 standardHeaders : true ,
89 legacyHeaders : false ,
9- message : { error : { code : "TOO_MANY_REQUESTS" , message : "Too many purchase requests" } }
10+ handler : ( req , res , next ) => next ( tooManyRequests ( "Too many purchase requests" ) )
1011} ) ;
You can’t perform that action at this time.
0 commit comments