Skip to content

Commit

Permalink
Use internalResponse at end of fetch handover
Browse files Browse the repository at this point in the history
This ensures that callers of `processResponseEndOfBody` and
`processResponseConsumeBody` would receive the correct body and
response without additional steps.

Closes #1512
  • Loading branch information
noamr committed Apr 30, 2023
1 parent 4502481 commit 0ec1636
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4792,7 +4792,11 @@ steps:
<a for="fetch params">process response</a> given <var>response</var>, with <var>fetchParams</var>'s
<a for="fetch params">task destination</a>.

<li><p>If <var>response</var>'s <a for=response>body</a> is null, then run
<li><p>Let <var>actualResponse</var> be <var>response</var>'s
<a for="filtered response">internal response</a> if <var>response</var> is a
<a>filtered response</a>; Otherwise <var>response</var>.

<li><p>If <var>actualResponse</var>'s <a for=response>body</a> is null, then run
<var>processResponseEndOfBody</var>.

<li>
Expand All @@ -4810,8 +4814,8 @@ steps:
<a for="TransformStream/set up"><i>flushAlgorithm</i></a> set to
<var>processResponseEndOfBody</var>.

<li><p>Set <var>response</var>'s <a for=response>body</a>'s <a for=body>stream</a> to the result
of <var>response</var>'s <a for=response>body</a>'s <a for=body>stream</a>
<li><p>Set <var>actualResponse</var>'s <a for=response>body</a>'s <a for=body>stream</a> to the
result of <var>actualResponse</var>'s <a for=response>body</a>'s <a for=body>stream</a>
<a for=ReadableStream>piped through</a> <var>transformStream</var>.
</ol>

Expand All @@ -4825,17 +4829,18 @@ steps:
<ol>
<li><p>Let <var>processBody</var> given <var>nullOrBytes</var> be this step: run
<var>fetchParams</var>'s <a for="fetch params">process response consume body</a> given
<var>response</var> and <var>nullOrBytes</var>.
<var>actualResponse</var> and <var>nullOrBytes</var>.

<li><p>Let <var>processBodyError</var> be this step: run <var>fetchParams</var>'s
<a for="fetch params">process response consume body</a> given <var>response</var> and failure.
<a for="fetch params">process response consume body</a> given <var>actualResponse</var> and
failure.

<li><p>If <var>response</var>'s <a for=response>body</a> is null, then <a>queue a fetch task</a>
<li><p>If <var>actualResponse</var>'s <a for=response>body</a> is null, then <a>queue a fetch task</a>
to run <var>processBody</var> given null, with <var>fetchParams</var>'s
<a for="fetch params">task destination</a>.

<li><p>Otherwise, <a for=body>fully read</a> <var>response</var>'s <a for=response>body</a> given
<var>processBody</var>, <var>processBodyError</var>, and <var>fetchParams</var>'s
<li><p>Otherwise, <a for=body>fully read</a> <var>actualResponse</var>'s <a for=response>body</a>
given <var>processBody</var>, <var>processBodyError</var>, and <var>fetchParams</var>'s
<a for="fetch params">task destination</a>.
</ol>
</ol>
Expand Down

0 comments on commit 0ec1636

Please sign in to comment.