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

Function waitForRequest

tests/browser/cancel.browser.test.js:71–84  ·  view source on GitHub ↗
(timeoutMs = 1000)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected