Fixed binary data from form-data not getting converted to base64 #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves brefphp/bref#1537 by not converting request body to UTF8 send form-data requests as base64. It utilize https://www.npmjs.com/package/body-parser as a middleware to get the raw request body as a buffer.
I'm not too sure of the implementation. I feels a bit hackish looking at the raw body to detect form-data requests. Additionally, form-data requests may contain content that can perfectly well be displayed in UTF8 (such as regular form-data or CSV file uploads).
Investigation with a AWS demo setup showed that even CSV uploads gets received in the Lambda as base64 encoded.
I'm wondering if it may be better to simply always send as base64. Unless of course AWS has some documentation hidden some where on how they detect if it should send base64 or not.
Looking for feedback.