ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

How do I use HTTP Proxies with this? #82

Open autistic-code opened 2 years ago

MarcelBurgard commented 1 year ago

You can use the core HTTP options to set a custom agent. For example with the node package https-proxy-agent, you can define an agent including your custom proxy and refer it in the core HTTP options. Would look something like:

import { HttpsProxyAgent } from "https-proxy-agent";

const agent = new HttpsProxyAgent("https://your-proxy.com");

await p({
  url: "https://ethanent.me/name",
  core: {
    agent: agent,
  },
});

You can also use different proxy agent packages like proxy-agent.

Hope this helps future viewers.