Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 2x 2x 2x 2x 52x 2x 2x 2x 2x 2x 2x 2x 52x 999x 998x 71x | // src/utils/rateLimit.ts
import { Request } from 'express';
const isTestEnv =
process.env.NODE_ENV === 'test' ||
process.env.NODE_ENV === 'development' ||
process.env.NODE_ENV === 'staging';
/**
* Helper to determine if rate limiting should be skipped.
* Skips in test environment unless explicitly enabled via header.
*/
export const shouldSkipRateLimit = (req: Request) => {
if (!isTestEnv) return false;
return req.headers['x-test-rate-limit-enable'] !== 'true';
};
|