Skip to content

Commit

Permalink
Merge a7e2c4f into ffe40a6
Browse files Browse the repository at this point in the history
  • Loading branch information
thtliife committed May 22, 2019
2 parents ffe40a6 + a7e2c4f commit 4c92cff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -46,6 +46,7 @@
"decompress-response": "^4.2.0",
"duplexer3": "^0.1.4",
"get-stream": "^5.0.0",
"https-proxy-agent": "^2.2.1",
"lowercase-keys": "^2.0.0",
"mimic-response": "^2.0.0",
"p-cancelable": "^2.0.0",
Expand Down
6 changes: 6 additions & 0 deletions source/normalize-arguments.ts
@@ -1,5 +1,6 @@
import urlLib, {URL, URLSearchParams} from 'url'; // TODO: Use the `URL` global when targeting Node.js 10
import CacheableLookup from 'cacheable-lookup';
import ProxyAgent from 'https-proxy-agent';
import is from '@sindresorhus/is';
import lowercaseKeys from 'lowercase-keys';
import urlToOptions from './utils/url-to-options';
Expand Down Expand Up @@ -183,6 +184,11 @@ export const normalizeArguments = (url, options, defaults?: any) => {
options.path = `${options.path.split('?')[0]}?${searchParams}`;
}

const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || undefined;
if (is.nonEmptyString(proxy)) {
options.agent = new ProxyAgent(proxy);
}

if (options.hostname === 'unix') {
const matches = /(.+?):(.+)/.exec(options.path);

Expand Down

0 comments on commit 4c92cff

Please sign in to comment.