Skip to content

Commit 9bfb777

Browse files
committed
Fix codec handling
This patch fixes how the encoding codec is handled across the entire codebase. Prior to this commit, support for codecs other than JSON was incomplete, mainly since the code assumed that all function output must be valid . Proper handling of codecs involves: * Validating JSON as the canonical input to function runner. * Encoding from JSON to a given codec if needed * Encoding to JSON from the function's output if needed and ensuring to keep save any encoding errors when needed. In order to achieve proper codec handling, I opted to encapsulate the details related to input and output bytes in a container (`BytesContainer`), which can either hold input or output bytes, and simiarly perform all the byte-level operations needed for reporting, such as calculating the length, presenting a human-readable representation, etc. This commit also adds the proper tests for each codec.
1 parent 5ab520d commit 9bfb777

File tree

17 files changed

+502
-222
lines changed

17 files changed

+502
-222
lines changed

Cargo.lock

Lines changed: 82 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ members = [
44
"tests/fixtures/log_truncation_function",
55
"tests/fixtures/exports",
66
"tests/fixtures/noop",
7+
"tests/fixtures/messagepack-valid",
8+
"tests/fixtures/messagepack-invalid", "tests/fixtures/echo",
79
]
810

911
[package]

0 commit comments

Comments
 (0)