From 386e20d01bf5dde83f84761d19d5562c4ac89f4d Mon Sep 17 00:00:00 2001 From: George Fu Date: Mon, 12 Aug 2024 15:11:32 +0000 Subject: [PATCH] fix(core/httpAuthSchemes): default sigv4aSigningRegionSet to undefined --- .../aws_sdk/resolveAwsSdkSigV4AConfig.spec.ts | 10 ++++++++++ .../aws_sdk/resolveAwsSdkSigV4AConfig.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.spec.ts diff --git a/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.spec.ts b/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.spec.ts new file mode 100644 index 000000000000..b1de6c8634ff --- /dev/null +++ b/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.spec.ts @@ -0,0 +1,10 @@ +import { resolveAwsSdkSigV4AConfig } from "./resolveAwsSdkSigV4AConfig"; + +describe(resolveAwsSdkSigV4AConfig.name, () => { + it("should normalize provider but default to undefined value", async () => { + const config = resolveAwsSdkSigV4AConfig({}); + + expect(typeof config.sigv4aSigningRegionSet).toEqual("function"); + expect(await config.sigv4aSigningRegionSet()).toEqual(undefined); + }); +}); diff --git a/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.ts b/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.ts index 9d210b451790..ab7eee8424c9 100644 --- a/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.ts +++ b/packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.ts @@ -39,7 +39,7 @@ export interface AwsSdkSigV4AAuthResolvedConfig { export const resolveAwsSdkSigV4AConfig = ( config: T & AwsSdkSigV4AAuthInputConfig & AwsSdkSigV4APreviouslyResolved ): T & AwsSdkSigV4AAuthResolvedConfig => { - config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet ?? []); + config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet); return config as T & AwsSdkSigV4AAuthResolvedConfig; };