Skip to content

Clone response in Lookup Race Response algorithm#1811

Merged
yoshisatoyanagisawa merged 1 commit intow3c:mainfrom
yoshisatoyanagisawa:clone
Dec 12, 2025
Merged

Clone response in Lookup Race Response algorithm#1811
yoshisatoyanagisawa merged 1 commit intow3c:mainfrom
yoshisatoyanagisawa:clone

Conversation

@yoshisatoyanagisawa
Copy link
Collaborator

@yoshisatoyanagisawa yoshisatoyanagisawa commented Dec 9, 2025

The "Lookup Race Response" algorithm returned a response from the race response map directly. This could lead to issues where a response body is consumed more than once, as a Response object's body cannot be reused across multiple fetch operations.

This change modifies the algorithm to return a clone of the response, aligning with the Fetch specification's standard practice for handling responses that may be used by multiple consumers. This ensures that each fetch handler receives a distinct, readable stream.

See also: https://fetch.spec.whatwg.org/#concept-response-clone


Preview | Diff

The "Lookup Race Response" algorithm returned a response from the race
response map directly. This could lead to issues where a response body
is consumed more than once, as a Response object's body cannot be reused
across multiple fetch operations.

This change modifies the algorithm to return a clone of the response,
aligning with the Fetch specification's standard practice for handling
responses that may be used by multiple consumers. This ensures that each
fetch handler receives a distinct, readable stream.

See also: https://fetch.spec.whatwg.org/#concept-response-clone
@yoshisatoyanagisawa
Copy link
Collaborator Author

@sisidovski Will you take a look?
@annevk FYI (this is a follow up of a6ed7c8)

Copy link
Contributor

@sisidovski sisidovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yoshisatoyanagisawa
Copy link
Collaborator Author

@monica-ch Will you review this?

Copy link
Collaborator

@monica-ch monica-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yoshisatoyanagisawa yoshisatoyanagisawa merged commit 3ff30ad into w3c:main Dec 12, 2025
2 checks passed
github-actions bot added a commit that referenced this pull request Dec 12, 2025
SHA: 3ff30ad
Reason: push, by yoshisatoyanagisawa

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot added a commit to asleekgeek/ServiceWorker that referenced this pull request Dec 12, 2025
SHA: 3ff30ad
Reason: push, by pull[bot]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot added a commit to yoshisatoyanagisawa/ServiceWorker that referenced this pull request Jan 23, 2026
SHA: 3ff30ad
Reason: push, by yoshisatoyanagisawa

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@yoshisatoyanagisawa yoshisatoyanagisawa deleted the clone branch January 23, 2026 08:29
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.

3 participants