You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use this to test my retry fetch util, but it doesn't seem to be working. I can see the timeout is being called, but it doesn't seem to timeout the request. Do you know if this is possible to test?
Code
const {timeout = 10000} = options;
const controller = new AbortController();
const id = setTimeout(() => {
controller.abort();
}, timeout);
res = await fetch(url, {
...options,
signal: controller.signal
});
clearTimeout(id);
Test
let called = 0;
mf.mock("GET@/api/hello/:name", async (_req: Request, params: any) => {
if (called++ === 0) {
await sleep(2);
return new Response();
}
return new Response(`Hello, ${params["name"]} ${called}!`, {
status: 200,
});
});
const res = await retryFetch("https://localhost:1234/api/hello/SeparateRecords", {timeout: 1000});
assertEquals(2, called);
assertEquals('Hello, SeparateRecords 2!', await res.text());
The text was updated successfully, but these errors were encountered:
I'm trying to use this to test my retry fetch util, but it doesn't seem to be working. I can see the timeout is being called, but it doesn't seem to timeout the request. Do you know if this is possible to test?
Code
Test
The text was updated successfully, but these errors were encountered: