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:
parent
abfd4bf9df
commit
9ce2271e81
@ -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
Normal file
7
test/parallel/test-https-agent-constructor.js
Normal 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);
|
Loading…
x
Reference in New Issue
Block a user