Re: [whatwg/fetch] Add chunk type checking of requestForServiceWorker's body's stream (#1199)

@domenic commented on this pull request.



> +    <ol>
+     <li> Let <var>transformAlgorithm</var> given <var>chunk</var> be these steps:
+      <ol>
+        <li><p>If the ongoing fetch is <a for=fetch>terminated</a>, then abort these steps.
+
+        <li><p>If <var>chunk</var> is not a {{Uint8Array}} object, then
+         <a lt=terminated for=fetch>terminate</a> the ongoing fetch.
+
+        <li>Otherwise, <a for=ReadableStream>enqueue</a> <var>chunk</var>. The user agent may split
+         the chunk and enqueues multiple times.
+      </ol>
+
+     <li> Let <var>transformStream</var> be result of <a for=TransformStream>creating</a> a
+      {{TransformStream}} with <var>transformAlgorithm</var>.
+
+     <li> Let <var>streamForServiceWorker</var> be result of pipeThrough

You can use https://streams.spec.whatwg.org/#rs-pipe-through directly. Something like

1. Perform ReadableStreamPipeTo(the stream, _transformStream_.[[writable]]).
1. Let _streamForServiceWorker_ be _transformStream_.[[readable]].

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1199#discussion_r597856000

Received on Friday, 19 March 2021 17:27:46 UTC