-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring isSerializableHeaderValue into smithy-client
- Loading branch information
Showing
6 changed files
with
56 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@smithy/smithy-client": patch | ||
--- | ||
|
||
serialize empty strings and collections in headers |
23 changes: 23 additions & 0 deletions
23
packages/smithy-client/src/is-serializable-header-value.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { isSerializableHeaderValue } from "./is-serializable-header-value"; | ||
|
||
describe(isSerializableHeaderValue.name, () => { | ||
it("considers empty strings serializable", () => { | ||
expect(isSerializableHeaderValue("")).toBe(true); | ||
}); | ||
|
||
it("considers empty collections serializable", () => { | ||
expect(isSerializableHeaderValue(new Set())).toBe(true); | ||
expect(isSerializableHeaderValue([])).toBe(true); | ||
}); | ||
|
||
it("considers most falsy data values to be serializable", () => { | ||
expect(isSerializableHeaderValue(false)).toBe(true); | ||
expect(isSerializableHeaderValue(0)).toBe(true); | ||
expect(isSerializableHeaderValue(new Date(0))).toBe(true); | ||
}); | ||
|
||
it("considered undefined and null to be unserializable", () => { | ||
expect(isSerializableHeaderValue(undefined)).toBe(false); | ||
expect(isSerializableHeaderValue(null)).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @internal | ||
* @returns whether the header value is serializable. | ||
*/ | ||
export const isSerializableHeaderValue = (value: any) => { | ||
return value != null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ain/resources/software/amazon/smithy/typescript/codegen/integration/http-binding-utils.ts
This file was deleted.
Oops, something went wrong.