Skip to content

Commit 6e118cf

Browse files
committed
deps: use fetchHttpHandler on web
1 parent 16bdb05 commit 6e118cf

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

package-lock.json

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@
522522
"@smithy/shared-ini-file-loader": "^3.0.0",
523523
"@smithy/util-retry": "^3.0.0",
524524
"@smithy/node-http-handler": "^3.0.0",
525+
"@smithy/fetch-http-handler": "^3.0.0",
525526
"@vscode/debugprotocol": "^1.57.0",
526527
"@zip.js/zip.js": "^2.7.41",
527528
"adm-zip": "^0.5.10",

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
UserAgent,
2727
} from '@aws-sdk/types'
2828
import { NodeHttpHandler } from '@smithy/node-http-handler'
29+
import { FetchHttpHandler } from '@smithy/fetch-http-handler'
2930
import { HttpResponse, HttpRequest } from '@aws-sdk/protocol-http'
3031
import { ConfiguredRetryStrategy } from '@smithy/util-retry'
3132
import { telemetry } from './telemetry/telemetry'
@@ -36,6 +37,7 @@ import { partialClone } from './utilities/collectionUtils'
3637
import { selectFrom } from './utilities/tsUtils'
3738
import { Agent } from 'http'
3839
import { once } from './utilities/functionUtils'
40+
import { isWeb } from './extensionGlobals'
3941

4042
export type AwsClientConstructor<C> = new (o: AwsClientOptions) => C
4143

@@ -92,11 +94,14 @@ export class AWSClientBuilderV3 {
9294
}
9395

9496
private buildHttpClient() {
95-
return new NodeHttpHandler({
96-
httpAgent: new Agent({ keepAlive: true, timeout: 30000 }),
97-
httpsAgent: new Agent({ keepAlive: true, timeout: 30000 }),
98-
logger: getLogger(),
99-
})
97+
return isWeb()
98+
? new FetchHttpHandler({
99+
keepAlive: true,
100+
})
101+
: new NodeHttpHandler({
102+
httpAgent: new Agent({ keepAlive: true, timeout: 30000 }),
103+
httpsAgent: new Agent({ keepAlive: true, timeout: 30000 }),
104+
})
100105
}
101106

102107
private getHttpClient = once(this.buildHttpClient.bind(this))

0 commit comments

Comments
 (0)