Skip to content

fix(ts-bindings): populate response headers in fetch()#4691

Open
philtrem wants to merge 7 commits intoclockworklabs:masterfrom
philtrem:fix/fetch-empty-headers
Open

fix(ts-bindings): populate response headers in fetch()#4691
philtrem wants to merge 7 commits intoclockworklabs:masterfrom
philtrem:fix/fetch-empty-headers

Conversation

@philtrem
Copy link

@philtrem philtrem commented Mar 23, 2026

Description of Changes

fetch() in TypeScript bindings was deserializing the full HttpResponse from BSATN (including headers), but then discarding them and always returning new Headers(). This adds a deserializeHeaders() helper that converts BSATN-deserialized HttpHeaders into a web-standard Headers object, so response headers are now correctly populated on the returned SyncResponse.

API and ABI breaking changes

None. Purely additive — no existing code depended on the (always-empty) headers.

Expected complexity level and risk

1 — Single-line behavioral change plus a small helper function. The fix mirrors the existing request-side encoding pattern.

Testing

  • Unit test: headers survive BSATN serialize/deserialize round-trip
  • Unit test: empty headers round-trip correctly
  • Verified deserializeHeaders uses the same textDecoder (UTF-8) as existing body decoding

…urning empty Headers

fetch() was deserializing the HttpResponse (including headers) from BSATN
but then discarding them, always returning `new Headers()`. This made it
impossible for procedures to inspect response metadata like Content-Type
or retry hints.

Add a `deserializeHeaders()` helper that converts the BSATN-decoded
HttpHeaders entries into a web-standard Headers object, and use it in
fetch().
@CLAassistant
Copy link

CLAassistant commented Mar 23, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants