Repository navigation
Keep the body of a cloned Request in the WPT harness - #8682
Merged
Merged
Conversation
The WPT harness replaces globalThis.Request with a subclass that resolves relative URLs, and relativizeRequest() then checks `input instanceof Request`, which now means the subclass. A Request from clone() is a plain Request, so it failed the check and was treated as a URL: new Request(r.clone()) became a GET to "[object Request]" with no body. That is why request-clone-readable-stream-body.any.js failed with both stream implementations, though workerd's Request keeps the body. In this patch the check uses the real Request, and the test is enabled for both stream implementations.
There was a problem hiding this comment.
✅ Approved — A small, correct fix to the harness's instanceof check, plus the matching changes to test expectations. No findings.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
The instanceof realRequest check accepts both plain Request objects and instances of the harness's subclass, which fixes the cloned-Request path. The expectation changes in api-test.ts and api-test-ts.ts match the fix.
📝 Documentation: ✅ LGTM
No documentation impact.
Reviewed commit: 5cb76fa5
npaun
approved these changes
Nov 19, 2026
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.
request/request-clone-readable-stream-body.any.jsfailed with both stream implementations, but workerd'sRequestkeeps the body. The WPT harness replacesglobalThis.Requestwith a subclass that resolves relative URLs. ItsrelativizeRequest()then checksinput instanceof Request, which now means the subclass. A Request fromclone()is a plainRequest, so it failed the check and was treated as a URL.new Request(r.clone())became a GET to"[object Request]"with no body.In this patch the check uses the real
Request, and the test is enabled for both stream implementations. All//src/wpt/...targets pass, so no other expectations change.//src/wpt:fetch/api@and//src/wpt:fetch/api-ts@each passed 100 of 100 runs with--runs_per_test=100.