Chore: use latest fetch from undici

This commit is contained in:
SukkaW
2024-10-10 21:31:49 +08:00
parent b8a145094a
commit 40cda6997a
4 changed files with 252 additions and 149 deletions

View File

@@ -1,6 +1,7 @@
import retry from 'async-retry';
import picocolors from 'picocolors';
import { setTimeout } from 'node:timers/promises';
import { fetch as _fetch } from 'undici';
function isClientError(err: unknown): err is NodeJS.ErrnoException {
if (!err || typeof err !== 'object') return false;
@@ -161,4 +162,4 @@ export const defaultRequestInit: RequestInit = {
}
};
export const fetchWithRetry = createFetchRetry(fetch);
export const fetchWithRetry = createFetchRetry(_fetch as any);