How to use the API through a Proxy?
This may sound like a stupid question but I can't make it work behind a proxy. What is the procedure to configure proxy information? Should it be done through NodeJS? (I tried to configure axios default to setup the proxy but it does not seem to work)
Thanks,
- Arnaud
Same Problem here.
Also running into the same issue. I forked the repo and added the following to lib/Requestable.js:
- Dependency on url-parse
- Dependency on https-proxy-agent
const URLParse = require('url-parse');
const HttpsProxyAgent = require('https-proxy-agent');
// ...
// in `_request`, where const config is defined
const config = {
url: url,
method: method,
headers: headers,
params: queryParams,
data: data,
responseType: raw ? 'text' : 'json',
};
//add proper support for proxy
if (process.env.https_proxy) {
var parsedUrl = URLParse(process.env.https_proxy);
var agent = new HttpsProxyAgent(parsedUrl.origin);
config.httpsAgent = agent;
config.proxy = false;
}
FYI this code does NOT cover all edge cases and I haven't created any unit tests for this, but it's working on my side as long as the https_proxy environment variable is set. Also, it currently doesn't support user/password auth which will be a requirement for some others.
https://github.com/mm-gmbd/github/releases/tag/v3.3.1 (you can include the following in your package.json):
"dependencies": {
"github-api": "git+https://github.com/mm-gmbd/github.git#v3.3.1",
}
Has the above code "released".
Also, the current code I've got for this is on my forked repo feature branch feature/proxy-support.