fix(ts-bindings): populate response headers in fetch()#4691
Open
philtrem wants to merge 7 commits intoclockworklabs:masterfrom
Open
fix(ts-bindings): populate response headers in fetch()#4691philtrem wants to merge 7 commits intoclockworklabs:masterfrom
philtrem wants to merge 7 commits intoclockworklabs:masterfrom
Conversation
…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().
8 tasks
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.
Description of Changes
fetch()in TypeScript bindings was deserializing the fullHttpResponsefrom BSATN (including headers), but then discarding them and always returningnew Headers(). This adds adeserializeHeaders()helper that converts BSATN-deserializedHttpHeadersinto a web-standardHeadersobject, so response headers are now correctly populated on the returnedSyncResponse.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
deserializeHeadersuses the sametextDecoder(UTF-8) as existing body decoding