@@ -26,6 +26,7 @@ import {
2626 UserAgent ,
2727} from '@aws-sdk/types'
2828import { NodeHttpHandler } from '@smithy/node-http-handler'
29+ import { FetchHttpHandler } from '@smithy/fetch-http-handler'
2930import { HttpResponse , HttpRequest } from '@aws-sdk/protocol-http'
3031import { ConfiguredRetryStrategy } from '@smithy/util-retry'
3132import { telemetry } from './telemetry/telemetry'
@@ -36,6 +37,7 @@ import { partialClone } from './utilities/collectionUtils'
3637import { selectFrom } from './utilities/tsUtils'
3738import { Agent } from 'http'
3839import { once } from './utilities/functionUtils'
40+ import { isWeb } from './extensionGlobals'
3941
4042export 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