Open
Description
📗 API Reference Docs Problem
- Version: v14.12.0
Location
Affected URL(s):
Description
In the following example provided for the https.request method, the request config object is passed both to the top level https request object, and to the agent property of said object.
This seems to either be a typo, or unclear. I would expect to see the following:
- "key" and "cert" should be provided to the agent object only, and should not appear at the top level of the options object.
- The properties that comprise the URL object ("hostname", "port", "path" and "method") should not be provided to the agent object.
I think this would avoid confusion.
const options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
options.agent = new https.Agent(options);
const req = https.request(options, (res) => {
// ...
});