Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support raw bytes as input & binary/blob/bit will be convert to Uint8Array #55

Merged
merged 4 commits into from
Feb 22, 2024

Conversation

shiyuhang0
Copy link
Collaborator

@shiyuhang0 shiyuhang0 commented Feb 20, 2024

In this PR, Serverless-js will handle the raw bytes more correct. we do two things:

  1. Support raw bytes as input (encoded with hex). Before this pr. raw bytes will be decoded to string with utf8, which will change the bytes when it is an invalid utf8 bytes.
  2. binary/blob/bit Type will be converted to Uint8Array as output. Before this PR, they will be converted to the string with utf8. (some bytes is not a valid utf8 bytes, we should not do this)

We also changed our backend, the backend will pass the hex string to serverless-js for binary/blob/bit. Before, the backend will replace invalid utf8 bytes with the Unicode replacement rune when encoded as JSON string. As a result, serverless-js may accept the wrong bytes.

@shiyuhang0 shiyuhang0 changed the title Test Support raw bytes: binary/blob/bit will be convert to Uint8Array Feb 21, 2024
@shiyuhang0 shiyuhang0 changed the title Support raw bytes: binary/blob/bit will be convert to Uint8Array Support raw bytes as input & binary/blob/bit will be convert to Uint8Array Feb 21, 2024
@shiyuhang0
Copy link
Collaborator Author

@shiyuhang0 shiyuhang0 merged commit 98b2f1e into main Feb 22, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants