Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1216@patch: Clone response body when cloning a response. #1219

Merged

Conversation

cprecioso
Copy link
Contributor

@cprecioso cprecioso commented Jan 17, 2024

Closes #1216

Simply clones the Response's body stream when cloning the response.

@cprecioso cprecioso changed the title #1216@trivial: Add response clone tests. #1216@patch: Clone response body when cloning a response. Jan 17, 2024
capricorn86
capricorn86 previously approved these changes Mar 9, 2024
Copy link
Owner

@capricorn86 capricorn86 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @cprecioso! 🌟

The Fetch API was migrated to using ReadableStream instead of Stream.Readable. This caused some issues when I merged in the changes as the clone solution used ReadableStream.tee(), which requires the cloned streams to be consumed in parallel.

I added support for piping the underlying Node Stream, which solved the problem.

@capricorn86 capricorn86 merged commit 235d06f into capricorn86:master Mar 9, 2024
3 checks passed
@cprecioso cprecioso deleted the task/1216-fix-response-clone branch March 10, 2024 19:46
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.

Cloned responses do not clone the underlying stream
2 participants