Reread a response body from JavaScript's fetch : <p><code>fetch()</code> returns promise which (if successful) resolves to a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response" rel="noreferrer"><code>Response</code></a> object. A very common thing to do is immediately call <a href="https://developer.mozilla.org/en-US/docs/Web/API/Body/json" rel="noreferrer"><code>Response.json()</code></a> to convert the response body to a JSON object.</p>

<p>If the response body isn't valid JSON, then the <code>Response.json()</code> promise fails with an error. The message is something along the lines of:</p>

<blockquote>
  <p>Unexpected token X in JSON at position 0</p>
</blockquote>

<p>That's not very helpful when trying to diagnose the problem; ideally I'd like to be able to see the content from the server (which is often an error message). </p>

<p>However, it appears that you can only read the stream at <code>Response.body</code> once (at least in Chrome). (There's even a read-only <a href="https://developer.mozilla.org/en-US/docs/Web/API/Body/bodyUsed" rel="noreferrer"><code>Response.bodyUsed</code></a> flag.) That has already happened when <code>Response.json()</code> tries to convert the body to JSON, so the body appears to be lost forever in the event of a JSON parsing failure.</p>

<p>Is there any way to recover the original response body... short of manually reading it (and then converting to JSON) when the original <code>fetch</code> Promise resolves?</p>
