Skip to content

Commit d51cd61

Browse files
cjihrigMylesBorins
authored andcommitted
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 07137ab commit d51cd61

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
@@ -97,6 +97,9 @@ function createConnection(port, host, options) {
9797

9898

9999
function Agent(options) {
100+
if (!(this instanceof Agent))
101+
return new Agent(options);
102+
100103
http.Agent.call(this, options);
101104
this.defaultPort = 443;
102105
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)