-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add ENV http_proxy support #195
Copy link
Copy link
Closed
Description
Basically, every time I use this package, the first thing that I need to do is to write an abstraction that enables use of HTTP_PROXY env variable.
Something like this:
import fetch from 'node-fetch';
import HttpsProxyAgent from 'https-proxy-agent';
export default (url: string, options: Object = {}) => {
const instanceOptions = {
...options
};
if (!options.agent && process.env.HTTP_PROXY) {
instanceOptions.agent = new HttpsProxyAgent(process.env.HTTP_PROXY);
}
return fetch(url, instanceOptions);
};I'd like this package to support it out of the box.
Using HTTP_PROXY and HTTPS_PROXY variables to configure proxy setting of an application is a well establish convention, https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=http_proxy%20environment%20variable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels