@@ -4,10 +4,12 @@ const fetch = require('node-fetch');
44const fs = require ( 'fs' ) ;
55const path = require ( 'path' ) ;
66const { CI_DOMAIN } = require ( './ci/ci_type_parser' ) ;
7+ const proxy = require ( './proxy' ) ;
78
89class Request {
910 constructor ( credentials ) {
1011 this . credentials = credentials ;
12+ this . proxyAgent = proxy ( ) ;
1113 }
1214
1315 loadQuery ( file ) {
@@ -16,6 +18,7 @@ class Request {
1618 }
1719
1820 async text ( url , options = { } ) {
21+ options . agent = this . proxyAgent ;
1922 if ( url . startsWith ( `https://${ CI_DOMAIN } ` ) ) {
2023 options . headers = options . headers || { } ;
2124 Object . assign ( options . headers , this . getJenkinsHeaders ( ) ) ;
@@ -24,6 +27,7 @@ class Request {
2427 }
2528
2629 async json ( url , options = { } ) {
30+ options . agent = this . proxyAgent ;
2731 options . headers = options . headers || { } ;
2832 options . headers . Accept = 'application/json' ;
2933 if ( url . startsWith ( `https://${ CI_DOMAIN } ` ) ) {
@@ -65,6 +69,7 @@ class Request {
6569 }
6670 const url = 'https://api.github.com/graphql' ;
6771 const options = {
72+ agent : this . proxyAgent ,
6873 method : 'POST' ,
6974 headers : {
7075 Authorization : `Basic ${ githubCredentials } ` ,
0 commit comments