CoolFace
Apppublic

legends810/testingnew

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
fetch.ts15 linesDownload Raw Back to lib
1type CommonRequest = Omit<RequestInit, 'body'> & { body?: URLSearchParams };2 3export async function request(url: string, init?: CommonRequest) {4  if (import.meta.env.DEV) {5    const nodeFetch = await import('node-fetch');6    const https = await import('node:https');7 8    const agent = url.startsWith('https') ? new https.Agent({ rejectUnauthorized: false }) : undefined;9 10    return nodeFetch.default(url, { ...init, agent });11  }12 13  return fetch(url, init);14}15