MCPcopy Create free account
hub / github.com/anus-dev/ANUS / shouldSimulate429

Function shouldSimulate429

packages/core/src/utils/testUtils.ts:21–40  ·  view source on GitHub ↗
(authType?: string)

Source from the content-addressed store, hash-verified

19 * Check if we should simulate a 429 error for the current request
20 */
21export function shouldSimulate429(authType?: string): boolean {
22 if (!simulate429Enabled || fallbackOccurred) {
23 return false;
24 }
25
26 // If auth type filter is set, only simulate for that auth type
27 if (simulate429ForAuthType && authType !== simulate429ForAuthType) {
28 return false;
29 }
30
31 requestCounter++;
32
33 // If afterRequests is set, only simulate after that many requests
34 if (simulate429AfterRequests > 0) {
35 return requestCounter > simulate429AfterRequests;
36 }
37
38 // Otherwise, simulate for every request
39 return true;
40}
41
42/**
43 * Reset the request counter (useful for tests)

Calls

no outgoing calls

Tested by

no test coverage detected