<p dir="auto">In <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="778252891" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/8990" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/8990/hovercard" href="https://github.com/denoland/deno/pull/8990">#8990</a> we added a WPT runner, and the entire WPT test suite to the repo. We are now able to run web platform tests. Currently only a very limited amount of tests is enabled, and many tests will fail once we enable testing them. We would like to get more coverage for our built in Web APIs. I have listed all of the suites that are potentially relevant for us below.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Compression (once we add <code class="notranslate">CompressionStream</code> and <code class="notranslate">DecompressionStream</code>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Broadcast Channel API (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="878971387" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/10527" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/10527/hovercard" href="https://github.com/denoland/deno/pull/10527">#10527</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Console API (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="779638611" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/9013" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/9013/hovercard" href="https://github.com/denoland/deno/pull/9013">#9013</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> DOM APIs
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> abort/event.any.js</li>
</ul>
</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Encoding (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="779266674" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/9004" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/9004/hovercard" href="https://github.com/denoland/deno/pull/9004">#9004</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> HR Time
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> monotonic-clock.any.js</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> window-worker-timeOrigin.window.js requires blob URL support for workers</li>
</ul>
</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> HTML
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> webappapis/atob</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> webappapis/timers</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> webappapis/microtask-queuing</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> various tests from browsers/the-window-object</li>
</ul>
</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Fetch API (ignore tests related to same site policy, like CORS)
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Requires relative <code class="notranslate">fetch</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="694349131" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/7369" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/7369/hovercard" href="https://github.com/denoland/deno/pull/7369">#7369</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Headers (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="859057995" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/10199" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/10199/hovercard" href="https://github.com/denoland/deno/pull/10199">#10199</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Request (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="859289842" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/10203" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/10203/hovercard" href="https://github.com/denoland/deno/pull/10203">#10203</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Response (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="859289842" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/10203" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/10203/hovercard" href="https://github.com/denoland/deno/pull/10203">#10203</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> fetch (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="859289842" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/10203" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/10203/hovercard" href="https://github.com/denoland/deno/pull/10203">#10203</a>)</li>
</ul>
</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> File API</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> WHATWG Stream API</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> URL API (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="781598957" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/9046" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/9046/hovercard" href="https://github.com/denoland/deno/pull/9046">#9046</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> User Timing (<code class="notranslate">self.perfomance</code>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> WebGPU (once we land it)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> WebSockets</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Workers (not the SharedWorker tests)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> WASM</li>
</ul>
<p dir="auto">If you would like to enable one of these suites (and fix the resulting issues), please comment on the issue so we don't have multiple people working on the same suites.</p>
<p dir="auto">I'm trying to make a proxy server that analyzes the response body for each request.</p>
<p dir="auto">The problem comes when using <code class="notranslate">res.clone()</code> after the request has been proxied, I try to save the body data after the server responds, and then return the response to the client like this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const body = await res.clone().body.json().catch(console.error)
await req.respond(res.clone()).catch(console.error)"><pre class="notranslate"><code class="notranslate">const body = await res.clone().body.json().catch(console.error)
await req.respond(res.clone()).catch(console.error)
</code></pre></div>
<p dir="auto">And the server throws <code class="notranslate">error: Uncaught TypeError: Failed to execute 'clone' on 'Response': Response body is already used</code> because the body stream seems to be the same and it has finished reading.<br>
I've tried <code class="notranslate">getReader()</code> too but it's not implemented yet</p>
<p dir="auto">Here is a minimum reproducible <a href="https://gist.github.com/sergiga/eea389f13147c6841fe726514d390a16">gist</a></p>
<p dir="auto">Meanwhile... is there any workaround of this issue?</p>
<p dir="auto">Thanks!</p>