File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import { DEFAULT_REQUEST_OPTIONS } from '@stoplight/spectral-runtime';
6
6
import lintCommand from './commands/lint' ;
7
7
8
8
if ( typeof process . env . PROXY === 'string' ) {
9
- const { protocol } = new URL ( process . env . PROXY ) ;
10
9
// eslint-disable-next-line @typescript-eslint/no-var-requires
11
10
const { HttpProxyAgent, HttpsProxyAgent } = require ( 'hpagent' ) as typeof import ( 'hpagent' ) ;
12
- DEFAULT_REQUEST_OPTIONS . agent = new ( protocol === 'https:' ? HttpsProxyAgent : HttpProxyAgent ) ( {
13
- proxy : process . env . PROXY ,
14
- } ) ;
11
+ const httpAgent = new HttpProxyAgent ( { proxy : process . env . PROXY } ) ;
12
+ const httpsAgent = new HttpsProxyAgent ( { proxy : process . env . PROXY } ) ;
13
+
14
+ DEFAULT_REQUEST_OPTIONS . agent = url => ( url . protocol === 'http:' ? httpAgent : httpsAgent ) ;
15
15
}
16
16
17
17
export default yargs
You can’t perform that action at this time.
0 commit comments