Re: [whatwg/fetch] Expose decoded/encoded size for constructed responses (PR #1456)

@annevk commented on this pull request.



> +
+    <ol>
+     <li><p><a for=TransformStream lt=enqueue>Enqueue</a> <var>chunk</var> in
+     <var>transformStream</var>.
+
+     <li>
+      <p>If <var>response</var>'s <a for=response>URL</a> is null, then:
+
+      <ol>
+       <li><p>Increment <var>response</var>'s <a for=response>body info</a>'s
+       <a for="response body info">encoded size</a> by <var>chunk</var>'s
+       <a for="byte sequence">length</a>.
+
+       <li><p>Set <var>response</var>'s <a for=response>body info</a>'s
+       <a for="response body info">decoded size</a> to <var>response</var>'s
+       <a for=response>body info</a>'s <a for="response body info">encoded size</a>

Needs a trailing dot.

> @@ -4426,8 +4426,30 @@ steps:
   <ol>
    <li><p>Let <var>transformStream</var> be a new {{TransformStream}}.
 
-   <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>Let <var>identityTransformAlgorithm</var> be the following steps given

Can we have a better name for this? _sizeTrackingTransformAlgorithm_ perhaps?

> @@ -4426,8 +4426,30 @@ steps:
   <ol>
    <li><p>Let <var>transformStream</var> be a new {{TransformStream}}.
 
-   <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>Let <var>identityTransformAlgorithm</var> be the following steps given
+    <a>byte sequence</a> <var>chunk</var>:
+
+    <ol>
+     <li><p><a for=TransformStream lt=enqueue>Enqueue</a> <var>chunk</var> in
+     <var>transformStream</var>.
+
+     <li>
+      <p>If <var>response</var>'s <a for=response>URL</a> is null, then:

How does this work? This runs after this step:

> If internalResponse’s [URL list](https://fetch.spec.whatwg.org/#concept-response-url-list) [is empty](https://infra.spec.whatwg.org/#list-is-empty), then set it to a [clone](https://infra.spec.whatwg.org/#list-clone) of request’s [URL list](https://fetch.spec.whatwg.org/#concept-request-url-list).

(And note that there are other responses that don't have a URL too.)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1456#pullrequestreview-1116704701

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1456/review/1116704701@github.com>

Received on Thursday, 22 September 2022 09:39:46 UTC