From 67765eb373ef9e4dc87fc3cc55f15a1a47c5004c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 16 Dec 2023 15:49:52 -0500 Subject: [PATCH] lib/request-browser: add keepalive option. --- lib/request-browser.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/request-browser.js b/lib/request-browser.js index eda065a..b20e30c 100644 --- a/lib/request-browser.js +++ b/lib/request-browser.js @@ -29,6 +29,7 @@ class RequestOptions { this.method = 'GET'; this.url = new URL('http://localhost'); + this.pool = false; this.agent = null; this.type = null; @@ -109,6 +110,11 @@ class RequestOptions { this.password = options.password; } + if (options.pool != null) { + assert(typeof options.pool === 'boolean'); + this.pool = options.pool; + } + if (options.agent != null) { assert(typeof options.agent === 'string'); this.agent = options.agent; @@ -287,7 +293,8 @@ class RequestOptions { credentials: auth ? 'include' : 'omit', cache: 'no-store', redirect: this.maxRedirects ? 'follow' : 'error', - referrer + referrer, + keepalive: this.pool }; if (this.body != null) {