File size: 333 Bytes
c7052c4
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { getHttpsAgent, getProxyAgent } from '../agentStore';

export async function externalServiceFetch(
  url: string,
  options?: RequestInit,
  proxyUrl?: string,
) {
  const agent = proxyUrl ? getProxyAgent(proxyUrl) : getHttpsAgent();
  return fetch(url, {
    ...options,
    ...(agent ? { dispatcher: agent } : {}),
  });
}