google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

add options.proxy support, not only env.HTTP_PROXY

Open vamcc opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. I want to add a proxy for request from googleapis. But env.HTTP_PROXY will affect requests from other request client(not only gaxios).And not every other request client support env.NO_PROXY. By reading docs and code of gaxios, I thought options.agent would be a solution for proxy.

import { google } from 'googleapis';

google.options({
  ...google._options,
  agent: new HttpsProxyAgent(proxy),
});

But it looks no effect on oauth2 part. I added some debug code in gaxios to print opts.agent: image Describe the solution you'd like I think google.options({proxy: 'xxx'} will be better. Describe alternatives you've considered Like what I mentioned above, I tried opts.agent. Additional context My issue in gaxios

vamcc avatar Jan 19 '23 03:01 vamcc