LibWeb: Add a 'piped through' helper method on ReadableStream

This reads a bit nicer, and follows the streams spec pattern on
performing operations on a stream outside of the streams spec.
This commit is contained in:
Shannon Booth 2024-12-24 12:25:01 +13:00 committed by Andreas Kling
parent 79a2b96d1c
commit da408cb09a
Notes: github-actions[bot] 2024-12-25 11:03:22 +00:00
5 changed files with 22 additions and 6 deletions
Libraries/LibWeb/Fetch/Fetching

View file

@ -744,7 +744,7 @@ void fetch_response_handover(JS::Realm& realm, Infrastructure::FetchParams const
transform_stream->set_up(identity_transform_algorithm, flush_algorithm);
// 4. Set internalResponses bodys stream to the result of internalResponses bodys stream piped through transformStream.
auto promise = Streams::readable_stream_pipe_to(internal_response->body()->stream(), transform_stream->writable(), false, false, false, {});
auto promise = internal_response->body()->stream()->piped_through(transform_stream->writable());
WebIDL::mark_promise_as_handled(*promise);
internal_response->body()->set_stream(transform_stream->readable());
}