Skip to content

Commit 0512de7

Browse files
committed
refactor: use handler wording
1 parent 9122915 commit 0512de7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class AWSClientBuilderV3 {
9191
return shim
9292
}
9393

94-
private buildHttpClient() {
94+
private buildHttpHandler() {
9595
const requestTimeout = 30000
9696
// HACK: avoid importing node-http-handler on web.
9797
return isWeb()
@@ -103,7 +103,7 @@ export class AWSClientBuilderV3 {
103103
})
104104
}
105105

106-
private getHttpClient = once(this.buildHttpClient.bind(this))
106+
private getHttpHandler = once(this.buildHttpHandler.bind(this))
107107

108108
private keyAwsService<C extends AwsClient>(serviceOptions: AwsServiceOptions<C>): string {
109109
// Serializing certain objects in the args allows us to detect when nested objects change (ex. new retry strategy, endpoints)
@@ -148,7 +148,7 @@ export class AWSClientBuilderV3 {
148148
}
149149

150150
if (!opt.requestHandler) {
151-
opt.requestHandler = this.getHttpClient()
151+
opt.requestHandler = this.getHttpHandler()
152152
}
153153
// TODO: add tests for refresh logic.
154154
opt.credentials = async () => {

packages/core/src/test/shared/awsClientBuilderV3.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('AwsClientBuilderV3', function () {
7878
assert.strictEqual(service.config.userAgent[0][0], 'CUSTOM USER AGENT')
7979
})
8080

81-
it('injects http client into client', function () {
81+
it('injects http client into handler', function () {
8282
const requestHandler = new NodeHttpHandler({
8383
requestTimeout: 1234,
8484
})
@@ -91,17 +91,18 @@ describe('AwsClientBuilderV3', function () {
9191
assert.strictEqual(service.config.requestHandler, requestHandler)
9292
})
9393

94-
it('defaults to reusing singular http client', function () {
94+
it('defaults to reusing singular http handler', function () {
9595
const service = builder.createAwsService({
9696
serviceClient: Client,
9797
})
9898
const service2 = builder.createAwsService({
9999
serviceClient: Client,
100100
})
101-
// Check if request handlers are reference-equal.
101+
102102
const firstHandler = service.config.requestHandler
103103
const secondHandler = service2.config.requestHandler
104104

105+
// If not injected, the http handler can be undefined before making request.
105106
if (firstHandler instanceof NodeHttpHandler && secondHandler instanceof NodeHttpHandler) {
106107
assert.ok(firstHandler === secondHandler)
107108
} else {

0 commit comments

Comments
 (0)