Skip to content

fix(proxy): preserve binary request bodies and support DELETE and OPTIONS bodies - #179

Closed
godgamerex3-boop wants to merge 1 commit into
tscircuit:mainfrom
godgamerex3-boop:fix/proxy-binary-body-preservation
Closed

godgamerex3-boop wants to merge 1 commit into
tscircuit:mainfrom
godgamerex3-boop:fix/proxy-binary-body-preservation

Conversation

@godgamerex3-boop

Copy link
Copy Markdown

Summary

Fixes request body handling in /proxy:

  1. Binary Body Preservation: Reads request bodies as an ArrayBuffer for all non-GET/HEAD requests (POST, PUT, PATCH, DELETE, OPTIONS) to prevent non-UTF-8 bytes from being corrupted by .text().
  2. DELETE & OPTIONS Body Forwarding: Forwards request payloads for DELETE and OPTIONS requests instead of dropping them.

Testing

  • Added 5 local echo-server regression tests in tests/routes/proxy-binary-body.test.ts covering POST, PUT, PATCH, DELETE, and OPTIONS with raw binary payloads (0x00, 0xff, 0xfe, 0x80, 0x41).
  • Full test suite: 34 passed / 0 failed (180 assertions) via bun test.

Fixes #157
/claim #157

…IONS bodies

- Read request body as arrayBuffer for all non-GET/HEAD methods to prevent UTF-8 corruption
- Forward request bodies for DELETE and OPTIONS methods
- Add comprehensive regression tests in tests/routes/proxy-binary-body.test.ts (5 tests covering POST, PUT, PATCH, DELETE, OPTIONS)

Fixes tscircuit#157
/claim tscircuit#157
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.

Proxy corrupts binary request bodies and drops DELETE/OPTIONS bodies (tested fix)

2 participants