gate-agent
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

gate-agent

Node.js Agent with HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (and their lower-case variants) support for node-fetch, got, and others.

Example

Use gate-agent/register to set the http and https global agents to gate-agent:

require("gate-agent/register");
 
// ...

Create a gate-agent instance for explicit usage:

const { GateAgent } = require("gate-agent");
const fetch = require("node-fetch");
 
const agent = new GateAgent();
const response = await fetch("...", { agent });

API

GateAgent

Options:

  • [httpProxy = process.env.HTTP_PROXY] - Set proxy for http requests
  • [httpsProxy = process.env.HTTPS_PROXY] - Set proxy for https and http requests
  • [noProxy = process.env.NO_PROXY] - Comma-separated list or array of wildcards to not proxy
  • http or https Agent options

gate-agent/register

Create a GateAgent instance and assign it to http.globalAgent and https.globalAgent.

/gate-agent/

    Package Sidebar

    Install

    npm i gate-agent

    Weekly Downloads

    10

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    105 kB

    Total Files

    7

    Last publish

    Collaborators

    • timhall