( headers: globalThis.Headers, )
| 687 | } |
| 688 | |
| 689 | export function applyMockHeaders( |
| 690 | headers: globalThis.Headers, |
| 691 | ): globalThis.Headers { |
| 692 | const mock = getMockHeaders() |
| 693 | if (!mock) { |
| 694 | return headers |
| 695 | } |
| 696 | |
| 697 | // Create a new Headers object with original headers |
| 698 | // eslint-disable-next-line eslint-plugin-n/no-unsupported-features/node-builtins |
| 699 | const newHeaders = new globalThis.Headers(headers) |
| 700 | |
| 701 | // Apply mock headers (overwriting originals) |
| 702 | Object.entries(mock).forEach(([key, value]) => { |
| 703 | if (value !== undefined) { |
| 704 | newHeaders.set(key, value) |
| 705 | } |
| 706 | }) |
| 707 | |
| 708 | return newHeaders |
| 709 | } |
| 710 | |
| 711 | // Check if we should process rate limits even without subscription |
| 712 | // This is for Ant employees testing with mocks |
no test coverage detected