GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: modernize and fix code examples in https.md · nodejs/node@811ccdf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • https.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/https.md‎

Copy file name to clipboardExpand all lines: doc/api/https.md
+10-9Lines changed: 10 additions & 9 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ const https = require('https');
6969
const fs = require('fs');
7070

7171
const options = {
72-
pfx: fs.readFileSync('server.pfx')
72+
pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
73+
passphrase: 'sample'
7374
};
7475

7576
https.createServer(options, (req, res) => {
@@ -143,14 +144,14 @@ Example:
143144
```js
144145
const https = require('https');
145146

146-
var options = {
147+
const options = {
147148
hostname: 'encrypted.google.com',
148149
port: 443,
149150
path: '/',
150151
method: 'GET'
151152
};
152153

153-
var req = https.request(options, (res) => {
154+
const req = https.request(options, (res) => {
154155
console.log('statusCode:', res.statusCode);
155156
console.log('headers:', res.headers);
156157

@@ -218,7 +219,7 @@ In order to specify these options, use a custom [`Agent`][].
218219
Example:
219220

220221
```js
221-
var options = {
222+
const options = {
222223
hostname: 'encrypted.google.com',
223224
port: 443,
224225
path: '/',
@@ -228,8 +229,8 @@ var options = {
228229
};
229230
options.agent = new https.Agent(options);
230231

231-
var req = https.request(options, (res) => {
232-
...
232+
const req = https.request(options, (res) => {
233+
// ...
233234
});
234235
```
235236

@@ -238,7 +239,7 @@ Alternatively, opt out of connection pooling by not using an `Agent`.
238239
Example:
239240

240241
```js
241-
var options = {
242+
const options = {
242243
hostname: 'encrypted.google.com',
243244
port: 443,
244245
path: '/',
@@ -248,8 +249,8 @@ var options = {
248249
agent: false
249250
};
250251

251-
var req = https.request(options, (res) => {
252-
...
252+
const req = https.request(options, (res) => {
253+
// ...
253254
});
254255
```
255256

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.