Commit c194838
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 c194838
File tree
17 files changed
+508
-222
lines changed- src
- tests
- fixtures
- build
- echo
- src
- messagepack-invalid
- src
- messagepack-valid
- src
17 files changed
+508
-222
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
0 commit comments