https: support agent construction without new

Fixes: https://github.com/nodejs/node/issues/12918
PR-URL: https://github.com/nodejs/node/pull/12927
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
cjihrig 2017-05-09 14:32:34 -04:00
parent abfd4bf9df
commit 9ce2271e81
2 changed files with 10 additions and 0 deletions

View File

@ -119,6 +119,9 @@ function createConnection(port, host, options) {
function Agent(options) {
if (!(this instanceof Agent))
return new Agent(options);
http.Agent.call(this, options);
this.defaultPort = 443;
this.protocol = 'https:';

View File

@ -0,0 +1,7 @@
'use strict';
require('../common');
const assert = require('assert');
const https = require('https');
assert.doesNotThrow(() => { https.Agent(); });
assert.ok(https.Agent() instanceof https.Agent);