Skip to content

Commit ac0c595

Browse files
committed
WIP: Fixing the support of WHATWG URLs
1 parent e145714 commit ac0c595

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ function HttpsProxyAgent(opts) {
3232
debug('creating new HttpsProxyAgent instance: %o', opts);
3333
Agent.call(this, opts);
3434

35-
var proxy = Object.assign({}, opts);
35+
var proxy;
36+
37+
// If the opts are genearted with the WHATWG API
38+
if (Object.getOwnPropertySymbols(opts)[0]) {
39+
proxy = Object.keys(opts[Object.getOwnPropertySymbols(opts)[0]]);
40+
proxy.protocol = proxy.scheme;
41+
} else {
42+
proxy = Object.assign({}, opts);
43+
}
3644

3745
// if `true`, then connect to the proxy server over TLS. defaults to `false`.
3846
this.secureProxy = proxy.protocol ? /^https:?$/i.test(proxy.protocol) : false;

0 commit comments

Comments
 (0)