Repository navigation
fix: preserve binary proxy request bodies - #158
Open
jztdjfcsdj wants to merge 2 commits into
Open
jztdjfcsdj wants to merge 2 commits into
jztdjfcsdj wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
/proxyreads POST, PUT, and PATCH bodies as text. Invalid UTF-8 bytes are replaced during decoding, so a payload of00 ff fe 80 41arrives upstream as00 ef bf bd ef bf bd ef bf bd 41. DELETE and OPTIONS bodies are dropped altogether, even though these methods are supported by the route.Read the body as an ArrayBuffer for every supported method except GET and HEAD. This preserves the original bytes and forwards bodies for DELETE and OPTIONS as well.
Five local echo-server regression cases cover POST, PUT, PATCH, DELETE, and OPTIONS. All five fail on the unchanged source and pass with the fix.
Validation with Bun 1.4.2 on Windows:
bun test: 34 passed, 0 failed (180 assertions), including existing GET and JSON POST coverage.bun x --no-install tsc --noEmit: passed.routes/files/upsert.ts); the baseline log is retained locally.Prepared with AI assistance; the listed tests were executed locally. This change is independent of the previously rewarded download-endpoint issue #5.
If you accept paid contributions for small fixes, would you consider a $3 reward? This is a compensation request, not a claim against an existing funded bounty.
Fixes #157.