(opts: {
headers?: Headers;
body?: unknown;
statusText?: string;
})
| 1600 | |
| 1601 | describe('HttpRateLimitError classification', () => { |
| 1602 | function rateLimitedJsonResponse(opts: { |
| 1603 | headers?: Headers; |
| 1604 | body?: unknown; |
| 1605 | statusText?: string; |
| 1606 | }): Response { |
| 1607 | const text = JSON.stringify(opts.body ?? {}); |
| 1608 | return createMockResponse({ |
| 1609 | status: 429, |
| 1610 | statusText: opts.statusText ?? 'Too Many Requests', |
| 1611 | headers: opts.headers ?? new Headers(), |
| 1612 | text: () => Promise.resolve(text), |
| 1613 | }); |
| 1614 | } |
| 1615 | |
| 1616 | it('throws HttpRateLimitError when retries exhausted with rate-limit body code', async () => { |
| 1617 | const rateLimitResponse = rateLimitedJsonResponse({ |
no test coverage detected
searching dependent graphs…