Skip to content

Commit 9ce2271

Browse files
committed
https: support agent construction without new
Fixes: #12918 PR-URL: #12927 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent abfd4bf commit 9ce2271

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/https.js

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ function createConnection(port, host, options) {
119119

120120

121121
function Agent(options) {
122+
if (!(this instanceof Agent))
123+
return new Agent(options);
124+
122125
http.Agent.call(this, options);
123126
this.defaultPort = 443;
124127
this.protocol = 'https:';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const https = require('https');
5+
6+
assert.doesNotThrow(() => { https.Agent(); });
7+
assert.ok(https.Agent() instanceof https.Agent);

0 commit comments

Comments
 (0)