Browse Source

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>
v6.x
cjihrig 8 years ago
committed by Myles Borins
parent
commit
d51cd61713
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 3
      lib/https.js
  2. 7
      test/parallel/test-https-agent-constructor.js

3
lib/https.js

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

7
test/parallel/test-https-agent-constructor.js

@ -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);
Loading…
Cancel
Save