Skip to content

fix(js): preserve Request headers and binary bodies - #717

Open
enginespot wants to merge 4 commits into
h4ckf0r0day:mainfrom
enginespot:fix/binary-fetch-request-bodies
Open

fix(js): preserve Request headers and binary bodies#717
enginespot wants to merge 4 commits into
h4ckf0r0day:mainfrom
enginespot:fix/binary-fetch-request-bodies

Conversation

@enginespot

@enginespot enginespot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What changed

Obscura version or commit: main (f449e6f)

  • serialize JavaScript request bodies as Uint8Array instead of binary strings
  • preserve Blob, ArrayBuffer, typed-array view bounds, Request bodies, and binary files in FormData
  • preserve headers from an existing Request unless RequestInit explicitly supplies replacement headers
  • pass request bytes unchanged through the normal reqwest transport and the stealth wreq transport
  • keep the existing public InterceptResolution string API compatible in this focused fix

This fixes fetch(Request) losing authentication or account headers and preserves binary request bodies without text coercion.

This is the first part of #716. The byte-native public interception API is split into a follow-up PR because it is a breaking change.

Validation

  • cargo nextest run --release -p obscura-js (406 passed)
  • focused JavaScript regressions covering Blob, ArrayBuffer, sliced views, Request headers and bodies, FormData, URLSearchParams, and XHR
  • cargo nextest run --release -p obscura-browser --test binary_fetch_body
  • cargo check --release --features render,stealth -p obscura-js
  • cargo nextest run --release --features stealth -p obscura-net stealth_post_does_not_retry_connection_reset
  • node --check crates/obscura-js/js/bootstrap.js
  • git diff --check

Rendering

Not applicable.

Performance

The request-body path passes byte buffers directly instead of expanding binary data into JavaScript/Rust strings. Request headers are enumerated once. No additional network round trips are introduced.

Checklist

  • The change is focused and does not remove existing behavior without justification.
  • Tests cover the failure.
  • Existing tests pass for the directly affected crates, including the stealth transport.
  • I checked the changed path for unnecessary copying and byte expansion.
  • Public API compatibility is preserved in this PR.

@enginespot enginespot changed the title fix(js): preserve binary fetch request bodies fix(js): preserve Request headers and binary bodies Aug 27, 2026
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.

1 participant