code: function proxy(options) {
    var proxy = null
      , isSSL = false
      ;
  
    if (options.protocol === 'https:') {
      isSSL = true;
    }
  
    // Test the proxy parameter first for priority
    if (proxyOptions) {
      proxy = proxyOptions;
    } else {
      // Test proxy by env
      if (proxyHttpEnv) {
        proxy = proxyHttpEnv;
      } else if (proxyHttpsEnv) {
        proxy = proxyHttpsEnv;
      }
    }
  
    if (!proxy) {
      return;
    }
  
    if (isSSL) {
      options.agent = new HttpsProxyAgent(proxy);
    } else {
      options.agent = new HttpProxyAgent(proxy);
    }
  }
docs: set the proxy agent for each http request priority : 1 - proxyOptions 2 - proxyHttpEnv (HTTP_PROXY) 3 - proxyHttpsEnv (HTTPS_PROXY)