You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds an API to dynamically enable built-in proxy support
for all of fetch() and http.request()/https.request(), so
that users do not have to be aware of them all and configure them
one by one.
PR-URL: #60953
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Tim Perry <[email protected]>
// We only support proxying for HTTP and HTTPS requests.
191
-
if(protocol!=='http:'&&protocol!=='https:'){
192
-
returnnull;
193
-
}
189
+
functionparseProxyUrl(env,protocol){
194
190
// Get the proxy url - following the most popular convention, lower case takes precedence.
195
191
// See https://about.gitlab.com/blog/we-need-to-talk-no-proxy/#http_proxy-and-https_proxy
196
192
constproxyUrl=(protocol==='https:') ?
@@ -204,6 +200,20 @@ function parseProxyConfigFromEnv(env, protocol, keepAlive) {
// We only support proxying for HTTP and HTTPS requests.
208
+
if(protocol!=='http:'&&protocol!=='https:'){
209
+
returnnull;
210
+
}
211
+
212
+
constproxyUrl=parseProxyUrl(env,protocol);
213
+
if(proxyUrl===null){
214
+
returnnull;
215
+
}
216
+
207
217
// Only http:// and https:// proxies are supported.
208
218
// Ignore instead of throw, in case other protocols are supposed to be
209
219
// handled by the user land.
@@ -244,6 +254,13 @@ function filterEnvForProxies(env) {
0 commit comments