Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 50s
13 lines
398 B
TypeScript
13 lines
398 B
TypeScript
// src/utils/rateLimit.ts
|
|
import { Request } from 'express';
|
|
|
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
|
|
/**
|
|
* 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';
|
|
}; |