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

fix: treat application/octet-stream as a binary encoding #1587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jankdc
Copy link

@jankdc jankdc commented Sep 30, 2022

Description

This extends the current workaround of converting the payloads of certain MIME types that are known to have binary data, hence the need to be encoded as a binary string.

Motivation and Context

This resolves an issue where binary encoded payloads like application/octet-stream in the body are being converted into string with utf8 as an encoding, causing data corruption when it reaches the function handler.

Adding more MIME types that are considered to be binary files seems a bit fragile so I think it's best to add just the application/octet-stream MIME type as it solves the use case where someone would want to send a file that isn't part of a multipart/form-data.

The real solution is to simulate what the actual API Gateway does which is to convert the payload into a base64 encoded string but I'm not sure what the consequence is yet for this repo so let's stick with this for now.

@jankdc jankdc force-pushed the fix/support-more-binary-mime-types branch from b8af7ae to 41b39de Compare September 30, 2022 13:02
@jankdc jankdc force-pushed the fix/support-more-binary-mime-types branch from 41b39de to 06ec76b Compare September 30, 2022 13:03
@dnalborczyk dnalborczyk reopened this Sep 24, 2023
@dnalborczyk
Copy link
Collaborator

close/re-open in order to run ci.

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