JacksonTian / httpx

http(s) module with power.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

proxy

dallascao opened this issue · comments

For anyone who wonders how to use https with a proxy, you can do it through proxy-agent:

const proxy = require('proxy-agent');
const httpx = require('httpx');

httpx.request('http://www.baidu.com/', {agent: new ProxyAgent("https://yourproxy:123")}).then((response) => {
  response.pipe(process.stdout);

  response.on('end', () => {
    process.stdout.write('\n');
  });
}, (err) => {
  // on error
});

bingo

I will add it into readme. Thank you.