@@ -25,6 +25,7 @@ const { urlToHttpOptions } = require('./utils')
25
25
*
26
26
* See https://github.com/TooTallNate/proxy-agents/issues/89
27
27
* An alternative is to use https://github.com/delvedor/hpagent
28
+ * @private
28
29
*/
29
30
class PatchedHttpsProxyAgent extends HttpsProxyAgent {
30
31
constructor ( proxyUrl , opts ) {
@@ -41,11 +42,11 @@ class PatchedHttpsProxyAgent extends HttpsProxyAgent {
41
42
* @private
42
43
*
43
44
* @param {string } resourceUrl an endpoint url for proxyAgent selection
44
- * @param {object } authOptions an object which contains auth information
45
+ * @param {ProxyAuthOptions } proxyOptions an object which contains auth information
45
46
* @returns {http.Agent } a http.Agent for basic auth proxy
46
47
*/
47
- function proxyAgent ( resourceUrl , authOptions ) {
48
- const { proxyUrl, username, password, rejectUnauthorized = true } = authOptions
48
+ function proxyAgent ( resourceUrl , proxyAuthOptions ) {
49
+ const { proxyUrl, username, password, rejectUnauthorized = true } = proxyAuthOptions
49
50
const proxyOpts = urlToHttpOptions ( proxyUrl )
50
51
51
52
if ( ! proxyOpts . auth && username && password ) {
@@ -70,6 +71,8 @@ function proxyAgent (resourceUrl, authOptions) {
70
71
*
71
72
* @typedef {object } ProxyAuthOptions
72
73
* @property {string } proxyUrl - the proxy's url
74
+ * @property {string } [username] the username for basic auth
75
+ * @property {string } [password] the password for basic auth
73
76
* @property {boolean } rejectUnauthorized - set to false to not reject unauthorized server certs
74
77
*/
75
78
@@ -80,11 +83,11 @@ class ProxyFetch {
80
83
/**
81
84
* Initialize this class with Proxy auth options
82
85
*
83
- * @param {ProxyAuthOptions } authOptions the auth options to connect with
86
+ * @param {ProxyAuthOptions } proxyAuthOptions the auth options to connect with
84
87
*/
85
- constructor ( authOptions = { } ) {
86
- logger . debug ( `constructor - authOptions: ${ JSON . stringify ( authOptions ) } ` )
87
- const { proxyUrl } = authOptions
88
+ constructor ( proxyAuthOptions = { } ) {
89
+ logger . debug ( `constructor - authOptions: ${ JSON . stringify ( proxyAuthOptions ) } ` )
90
+ const { proxyUrl } = proxyAuthOptions
88
91
const { auth } = urlToHttpOptions ( proxyUrl )
89
92
90
93
if ( ! proxyUrl ) {
@@ -96,7 +99,7 @@ class ProxyFetch {
96
99
logger . debug ( 'constructor: username or password not set, proxy is anonymous.' )
97
100
}
98
101
99
- this . authOptions = authOptions
102
+ this . authOptions = proxyAuthOptions
100
103
return this
101
104
}
102
105
0 commit comments