From ff8a9dfce38c027e05b5130ba4c554237fea7065 Mon Sep 17 00:00:00 2001 From: howiezhao Date: Sun, 27 Apr 2025 11:13:16 +0800 Subject: [PATCH] chore: corrected description of keepAlive option --- posts/ar/req_config.md | 4 +++- posts/en/req_config.md | 4 +++- posts/zh/req_config.md | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/posts/ar/req_config.md b/posts/ar/req_config.md index e97b3849..adc85a48 100644 --- a/posts/ar/req_config.md +++ b/posts/ar/req_config.md @@ -149,7 +149,9 @@ These are the available config options for making requests. Only the `url` is re // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http // and https requests, respectively, in node.js. This allows options to be added like - // `keepAlive` that are not enabled by default. + // `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js + // v19.0.0, you no longer need to customize the agent to enable `keepAlive` because + // `http.globalAgent` has `keepAlive` enabled by default. httpAgent: new http.Agent({ keepAlive: true }), httpsAgent: new https.Agent({ keepAlive: true }), diff --git a/posts/en/req_config.md b/posts/en/req_config.md index 68dd3c9b..dfc51414 100644 --- a/posts/en/req_config.md +++ b/posts/en/req_config.md @@ -154,7 +154,9 @@ These are the available config options for making requests. Only the `url` is re // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http // and https requests, respectively, in node.js. This allows options to be added like - // `keepAlive` that are not enabled by default. + // `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js + // v19.0.0, you no longer need to customize the agent to enable `keepAlive` because + // `http.globalAgent` has `keepAlive` enabled by default. httpAgent: new http.Agent({ keepAlive: true }), httpsAgent: new https.Agent({ keepAlive: true }), diff --git a/posts/zh/req_config.md b/posts/zh/req_config.md index b0ef998d..2fcba218 100644 --- a/posts/zh/req_config.md +++ b/posts/zh/req_config.md @@ -138,9 +138,10 @@ next_link: '/zh/docs/res_schema' // 若都指定,这使用 `socketPath` 。 socketPath: null, // default - // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http - // and https requests, respectively, in node.js. This allows options to be added like - // `keepAlive` that are not enabled by default. + // `httpAgent` 和 `httpsAgent` 分别定义了在 node.js 中执行 http 和 https 请求时使用的自定义代理。 + // 这允许添加诸如 `keepAlive` 之类的选项,这些选项在 Node.js v19.0.0 之前默认未启用。 + // 在 Node.js v19.0.0 之后,不再需要自定义代理来启用 `keepAlive`, + // 因为 `http.globalAgent` 已经默认启用了 `keepAlive`。 httpAgent: new http.Agent({ keepAlive: true }), httpsAgent: new https.Agent({ keepAlive: true }),