Open
Description
How do you use cross-fetch in a node app where you need to use network proxies? For node-fetch@2 I can just
import { HttpsProxyAgent } from 'https-proxy-agent'
const proxyUrl = 'http://127.0.0.1:9000'
const agent = new HttpsProxyAgent(proxyUrl)
const res = await fetch('https://www.google.com', { agent })
. . .
when I replace node-fetch with cross-fetch on the import I get a type error on the { agent }
No overload matches this call.
Overload 1 of 2, '(input: string | URL | Request, init?: RequestInit | undefined): Promise<Response>', gave the following error.
Object literal may only specify known properties, and 'agent' does not exist in type 'RequestInit'.
Overload 2 of 2, '(input: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>', gave the following error.
Object literal may only specify known properties, and 'agent' does not exist in type 'RequestInit'.ts(2769)
Thanks,
Metadata
Metadata
Assignees
Labels
No labels