feat(runtime): add Request.clone() and Response.clone() per Fetch Standard §7.3/§7.4#4993
Merged
jedel1043 merged 2 commits intoboa-dev:mainfrom Mar 18, 2026
Conversation
Test262 conformance changes
Tested main commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4993 +/- ##
===========================================
+ Coverage 47.24% 59.36% +12.11%
===========================================
Files 476 580 +104
Lines 46892 63160 +16268
===========================================
+ Hits 22154 37493 +15339
- Misses 24738 25667 +929 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Hi @jedel1043 can you pls review this pr whenever you get a chance. |
jedel1043
requested changes
Mar 16, 2026
a024ef8 to
1989e57
Compare
1989e57 to
5c14131
Compare
…ndard §7.3/§7.4 - Request.clone() deep-copies method/headers/body; shares signal per spec - Response.clone() deep-copies all fields including independent headers - headers.rs: add deep_clone() for spec-compliant header independence Closes boa-dev#4992
5c14131 to
ae8bb92
Compare
jedel1043
approved these changes
Mar 18, 2026
Member
jedel1043
left a comment
There was a problem hiding this comment.
LGTM
Ping me when you resolve the conflicts so that we can merge
…ponse-clone-4992 # Conflicts: # core/runtime/src/fetch/tests/response.rs
Contributor
Author
|
@jedel1043 i have resolved the merge conflicts. |
Contributor
Author
|
Thanks Jedel |
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.
Summary
Closes #4992
Implements
clone()onRequestandResponseobjects inboa_runtimeper Fetch Standard §7.3 and §7.4.Changes
pub(crate) fn deep_clone()onJsHeadersto produce a fully independent header map copy.body_used: Cell<bool>tracking field andclone()method. ThrowsTypeErrorif body is already used.body_used: Cell<bool>tracking field andclone()method. ThrowsTypeErrorif body is already used.bytes(),text(), andjson()now also throwTypeErroron a consumed body and mark it as used.Behavior
request.clone()returns a newRequestwith an independent copy of method, headers, and body. SharesAbortSignalwhen signal support is wired intoJsRequest(follow-up).response.clone()returns a newResponsewith independent copies of status, headers, body, and url.TypeErrorif the body has already been consumed.Testing
cargo check -p boa_runtimepassescargo clippy --all-features --all-targets -- -D warningspassescargo fmt --all -- --checkpassescargo test -p boa_runtimepassesSpec References