Closed reyou closed 8 years ago
I would just not call .proxy()
if your proxy
var is falsey:
// if config is enabled return http://127.0.0.1:8888
// else return null
var proxy = process.env.http_proxy || config.getProxyAddress();
var req = request.get(url)
.set('Authorization', 'Bearer ' + authCode);
if (proxy) req.proxy(proxy);
Actually this pull request does exactly what I am asking for;
https://github.com/gebrits/superagent-proxy/commit/a2f0a060d616a9452630c45c91bb1fd4dc459ba9
Is it possible to accept it?
For now thanks for your response, I will try that.
This works for me:
request
.get(url)
.proxy(proxy || url)
.set('Authorization', 'Bearer ' + authCode)
Does it work for others?
realised this doesn't work as intended when url
is using https
:-1:
I have following code;
// if config is enabled return http://127.0.0.1:8888 // else return null var proxy = process.env.http_proxy || config.getProxyAddress();
request .get(url) .proxy(proxy) .set('Authorization', 'Bearer ' + authCode)
here if I pass proxy as null or empty string it throws error of: "TypeError: an HTTP(S) proxy server
host
andprotocol
must be specified!" but I would like to depend on my config settings.How can I enable this?
In this case, if proxy is null or empty can we just bypass and do not use proxy?