Skip to content

Commit

Permalink
lib/request-browser: add keepalive option.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Dec 16, 2023
1 parent 22e6d65 commit 67765eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/request-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class RequestOptions {

this.method = 'GET';
this.url = new URL('http://localhost');
this.pool = false;
this.agent = null;

this.type = null;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 67765eb

Please sign in to comment.