Skip to content

Commit

Permalink
chore(middleware-compression): export default configuration values (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Jan 2, 2024
1 parent d25d91d commit 8284273
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
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,
};

0 comments on commit 8284273

Please sign in to comment.