Skip to content

Commit d86c798

Browse files
committed
fix: default keepalive=false for fetch
1 parent 5fb6d4c commit d86c798

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/sixty-scissors-bake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/fetch-http-handler": patch
3+
---
4+
5+
set keepalive default to false in fetch handler

packages/fetch-http-handler/src/fetch-http-handler.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ export interface FetchHttpHandlerOptions {
1717
requestTimeout?: number;
1818

1919
/**
20-
* Whether to allow the request to outlive the page. Default value is true
20+
* Whether to allow the request to outlive the page. Default value is false.
21+
*
22+
* There may be limitations to the payload size, number of concurrent requests,
23+
* request duration etc. when using keepalive in browsers.
24+
*
25+
* These may change over time, so look for up to date information about
26+
* these limitations before enabling keepalive.
2127
*/
2228
keepAlive?: boolean;
2329
}
@@ -59,7 +65,7 @@ export class FetchHttpHandler implements HttpHandler<FetchHttpHandlerConfig> {
5965
this.config = await this.configProvider;
6066
}
6167
const requestTimeoutInMs = this.config!.requestTimeout;
62-
const keepAlive = this.config!.keepAlive ?? true;
68+
const keepAlive = this.config!.keepAlive === true;
6369

6470
// if the request was already aborted, prevent doing extra work
6571
if (abortSignal?.aborted) {

0 commit comments

Comments
 (0)