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
cjihrig 8 years ago
parent
commit
9ce2271e81
  1. 3
      lib/https.js
  2. 7
      test/parallel/test-https-agent-constructor.js

3
lib/https.js

@ -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:';

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