googleapis / googleapis/google-api-nodejs-client

add options.proxy support, not only env.HTTP_PROXY

Open
#3,146 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

**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.
``` typescript
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](https://github.com/googleapis/gaxios/issues/520) in `gaxios`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.