MCPcopy
hub / github.com/axios/axios / waitForRequest

Function waitForRequest

tests/browser/instance.browser.test.js:76–89  ·  view source on GitHub ↗
(timeoutMs = 1000)

Source from the content-addressed store, hash-verified

74};
75
76const waitForRequest = async (timeoutMs = 1000) => {
77 const start = Date.now();
78
79 while (Date.now() - start < timeoutMs) {
80 const request = requests.at(-1);
81 if (request) {
82 return request;
83 }
84
85 await Promise.resolve();
86 }
87
88 throw new Error('Expected an XHR request to be sent');
89};
90
91describe('instance (vitest browser)', () => {
92 beforeEach(() => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected