Skip to content

Commit 8284273

Browse files
authored
chore(middleware-compression): export default configuration values (#5628)
1 parent d25d91d commit 8284273

4 files changed

+18
-6
lines changed

Diff for: packages/middleware-compression/src/NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { booleanSelector, SelectorType } from "@smithy/util-config-provider";
22

33
import {
4+
DEFAULT_DISABLE_REQUEST_COMPRESSION,
45
NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS,
56
NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME,
67
NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME,
@@ -43,8 +44,8 @@ describe("NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS", () => {
4344
test(configFileSelector, profileContent, NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME, SelectorType.CONFIG);
4445
});
4546

46-
it("returns false for default", () => {
47+
it(`returns ${DEFAULT_DISABLE_REQUEST_COMPRESSION} for default`, () => {
4748
const { default: defaultValue } = NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS;
48-
expect(defaultValue).toEqual(false);
49+
expect(defaultValue).toEqual(DEFAULT_DISABLE_REQUEST_COMPRESSION);
4950
});
5051
});

Diff for: packages/middleware-compression/src/NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export const NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME = "AWS_DISABLE_REQUEST_CO
1111
*/
1212
export const NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME = "disable_request_compression";
1313

14+
/**
15+
* @internal
16+
*/
17+
export const DEFAULT_DISABLE_REQUEST_COMPRESSION = false;
18+
1419
/**
1520
* @internal
1621
*/
@@ -19,5 +24,5 @@ export const NODE_DISABLE_REQUEST_COMPRESSION_CONFIG_OPTIONS: LoadedConfigSelect
1924
booleanSelector(env, NODE_DISABLE_REQUEST_COMPRESSION_ENV_NAME, SelectorType.ENV),
2025
configFileSelector: (profile) =>
2126
booleanSelector(profile, NODE_DISABLE_REQUEST_COMPRESSION_INI_NAME, SelectorType.CONFIG),
22-
default: false,
27+
default: DEFAULT_DISABLE_REQUEST_COMPRESSION,
2328
};

Diff for: packages/middleware-compression/src/NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { numberSelector, SelectorType } from "@smithy/util-config-provider";
22

33
import {
4+
DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES,
45
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS,
56
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME,
67
NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME,
@@ -43,8 +44,8 @@ describe("NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS", () => {
4344
test(configFileSelector, profileContent, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME, SelectorType.CONFIG);
4445
});
4546

46-
it("returns 10240 for default", () => {
47+
it(`returns ${DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES} for default`, () => {
4748
const { default: defaultValue } = NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS;
48-
expect(defaultValue).toEqual(10240);
49+
expect(defaultValue).toEqual(DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES);
4950
});
5051
});

Diff for: packages/middleware-compression/src/NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME = "AWS_REQUEST_MIN
1111
*/
1212
export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME = "request_min_compression_size_bytes";
1313

14+
/**
15+
* @internal
16+
*/
17+
export const DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES = 10240;
18+
1419
/**
1520
* @internal
1621
*/
@@ -19,5 +24,5 @@ export const NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_CONFIG_OPTIONS: LoadedConfi
1924
numberSelector(env, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_ENV_NAME, SelectorType.ENV),
2025
configFileSelector: (profile) =>
2126
numberSelector(profile, NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES_INI_NAME, SelectorType.CONFIG),
22-
default: 10240,
27+
default: DEFAULT_NODE_REQUEST_MIN_COMPRESSION_SIZE_BYTES,
2328
};

0 commit comments

Comments
 (0)