Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(middleware-compression): export default configuration values #5628

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { booleanSelector, SelectorType } from "@smithy/util-config-provider";

import {
DEFAULT_DISABLE_REQUEST_COMPRESSION,
NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS,
NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME,
NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME,
Expand Down Expand Up @@ -43,8 +44,8 @@ describe("NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS", () => {
test(configFileSelector, profileContent, NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME, SelectorType.CONFIG);
});

it("returns false for default", () => {
it(`returns ${DEFAULT_DISABLE_REQUEST_COMPRESSION} for default`, () => {
const { default: defaultValue } = NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS;
expect(defaultValue).toEqual(false);
expect(defaultValue).toEqual(DEFAULT_DISABLE_REQUEST_COMPRESSION);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME = "AWS_DISABLE_REQUEST_CO
*/
export const NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME = "disable_request_compression";

/**
* @internal
*/
export const DEFAULT_DISABLE_REQUEST_COMPRESSION = false;

/**
* @internal
*/
Expand All @@ -19,5 +24,5 @@ export const NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS: LoadedConfigSelect
booleanSelector(env, NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME, SelectorType.ENV),
configFileSelector: (profile) =>
booleanSelector(profile, NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME, SelectorType.CONFIG),
default: false,
default: DEFAULT_DISABLE_REQUEST_COMPRESSION,
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { numberSelector, SelectorType } from "@smithy/util-config-provider";

import {
DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES,
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS,
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME,
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME,
Expand Down Expand Up @@ -43,8 +44,8 @@ describe("NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS", () => {
test(configFileSelector, profileContent, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME, SelectorType.CONFIG);
});

it("returns 10240 for default", () => {
it(`returns ${DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES} for default`, () => {
const { default: defaultValue } = NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS;
expect(defaultValue).toEqual(10240);
expect(defaultValue).toEqual(DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME = "AWS_REQUEST_MIN
*/
export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME = "request_min_compression_size_bytes";

/**
* @internal
*/
export const DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES = 10240;

/**
* @internal
*/
Expand All @@ -19,5 +24,5 @@ export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS: LoadedConfi
numberSelector(env, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME, SelectorType.ENV),
configFileSelector: (profile) =>
numberSelector(profile, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME, SelectorType.CONFIG),
default: 10240,
default: DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES,
};
Loading