Re: [whatwg/fetch] Attach timing info and URL to network errors, and report for fetch API (#1311)

@annevk commented on this pull request.



> @@ -4219,26 +4277,16 @@ steps:
    <var>processBody</var>, <var>processBodyError</var>, and <var>fetchParams</var>'s
    <a for="fetch params">task destination</a>.
   </ol>
-</ol>
-
-<p>To <dfn>finalize response</dfn> given a <a for=/>fetch params</a> <var>fetchParams</var> and a
-<a for=/>response</a> <var>response</var>, run these steps:
-
-<ol>
- <li><p>Set <var>fetchParams</var>'s <a for="fetch params">request</a>'s
- <a for=request>done flag</a>.
-
- <li><p>If <var>fetchParams</var>'s <a for="fetch params">process response done</a> is not null,
- then <a>queue a fetch task</a> to run <var>fetchParams</var>'s
- <a for="fetch params">process response done</a> given <var>response</var>,
- with <var>fetchParams</var>'s <a for="fetch params">task destination</a>.
+ </li>

Nit: no need for this closing tag.

> +
+   <li><p>Let <var>identityTransformAlgorithm</var> be an algorithm which, given <var>chunk</var>,
+   <a for=TransformStream lt=enqueue>enqueues</a> <var>chunk</var> in <var>transformStream</var>.
+
+   <li><p><a for=TransformStream lt="setting up">Set up</a> <var>transformStream</var> with
+   [=TransformStream/set up/transformalgorithm=] set to <var>identityTransformAlgorithm</var> and
+   [=TransformStream/set up/flushalgorithm=] set to <var>processResponseDone</var>.
+
+   <li><p>Set <var>response</var>'s <a for=response>body</a> to the result of
+   <a for=ReadableStream lt="piping through">piping</a> <var>response</var>'s
+   <a for=response>body</a> through <var>transformStream</var>.
+  </ol>
+
+  <p class=note>This {{TransformStream}} is needed for the purpose of receiving a notification when
+  the stream reaches its end, and is otherwise an [=identity transform stream=].
+ </li>

Nit: no need for this closing tag.

> + <li>
+  <p>Let <var>processResponseDone</var> be the following steps:
+
+  <ol>
+   <li><p>Set <var>fetchParams</var>'s <a for="fetch params">request</a>'s
+   <a for=request>done flag</a>.
+
+   <li><p>If <var>fetchParams</var>'s <a for="fetch params">process response done</a> is not null,
+   then <a>queue a fetch task</a> to run <var>fetchParams</var>'s
+   <a for="fetch params">process response done</a> given <var>response</var> with
+   <var>fetchParams</var>'s <a for="fetch params">task destination</a>.
+  </ol>
+ </li>
+
+ <li><p>If <var>response</var>'s <a for=response>body</a> is null, then run
+ <var>processResponseDone</var>.

This makes it run before "process response", which seems bad?

-- 
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/1311#pullrequestreview-825211491

Received on Tuesday, 7 December 2021 12:33:41 UTC