Skip to content

Commit ef1a77a

Browse files
chore: corrected description of keepAlive option (#248)
Co-authored-by: Jay <[email protected]>
1 parent 11545fc commit ef1a77a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

posts/ar/req_config.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ These are the available config options for making requests. Only the `url` is re
149149

150150
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
151151
// and https requests, respectively, in node.js. This allows options to be added like
152-
// `keepAlive` that are not enabled by default.
152+
// `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js
153+
// v19.0.0, you no longer need to customize the agent to enable `keepAlive` because
154+
// `http.globalAgent` has `keepAlive` enabled by default.
153155
httpAgent: new http.Agent({ keepAlive: true }),
154156
httpsAgent: new https.Agent({ keepAlive: true }),
155157

posts/en/req_config.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ These are the available config options for making requests. Only the `url` is re
154154

155155
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
156156
// and https requests, respectively, in node.js. This allows options to be added like
157-
// `keepAlive` that are not enabled by default.
157+
// `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js
158+
// v19.0.0, you no longer need to customize the agent to enable `keepAlive` because
159+
// `http.globalAgent` has `keepAlive` enabled by default.
158160
httpAgent: new http.Agent({ keepAlive: true }),
159161
httpsAgent: new https.Agent({ keepAlive: true }),
160162

posts/zh/req_config.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ next_link: '/zh/docs/res_schema'
138138
// 若都指定,这使用 `socketPath` 。
139139
socketPath: null, // default
140140

141-
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
142-
// and https requests, respectively, in node.js. This allows options to be added like
143-
// `keepAlive` that are not enabled by default.
141+
// `httpAgent` 和 `httpsAgent` 分别定义了在 node.js 中执行 http 和 https 请求时使用的自定义代理。
142+
// 这允许添加诸如 `keepAlive` 之类的选项,这些选项在 Node.js v19.0.0 之前默认未启用。
143+
// 在 Node.js v19.0.0 之后,不再需要自定义代理来启用 `keepAlive`,
144+
// 因为 `http.globalAgent` 已经默认启用了 `keepAlive`。
144145
httpAgent: new http.Agent({ keepAlive: true }),
145146
httpsAgent: new https.Agent({ keepAlive: true }),
146147

0 commit comments

Comments
 (0)