UNPKG

@redocly/cli

Version:

[@Redocly](https://redocly.com) CLI is your all-in-one API documentation utility. It builds, manages, improves, and quality-checks your API descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make

23 lines 706 B
import { getProxyUrl } from './proxy-agent.js'; import { Agent, ProxyAgent } from 'undici'; export default async (url, { timeout, ...options } = {}) => { const proxyUrl = getProxyUrl(); let dispatcher; const connectOptions = timeout ? { connect: { timeout } } : {}; if (proxyUrl) { dispatcher = new ProxyAgent({ uri: proxyUrl, ...connectOptions, }); } else if (timeout) { dispatcher = new Agent(connectOptions); } const res = await fetch(url, { signal: timeout ? AbortSignal.timeout(timeout) : undefined, ...options, dispatcher, }); return res; }; //# sourceMappingURL=fetch-with-timeout.js.map