elbywan / wretch

A tiny wrapper built around fetch with an intuitive syntax. :candy:
MIT License
4.83k stars 98 forks source link

proxy support #18

Closed konsumer closed 6 years ago

konsumer commented 6 years ago

Is there a way to use a proxy?

Normally, I would setup a HttpsProxyAgent then pass that as agent to https.get()

elbywan commented 6 years ago

I guess it really depends on which fetch polyfill you are using !

If you rely on node-fetch, then it seems like you could use the agent option to pass the HttpsProxyAgent instance.

// Assuming you already polyfilled wretch with node-fetch
// see https://github.com/elbywan/wretch#nodejs

wretch(/* url */, { ...fetchOptions, agent: yourAgentInstance })
konsumer commented 6 years ago

Perfect, thanks!