OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Why can I not read a body stream multiple times in javascript?

  • Thread starter Thread starter JobHunter69
  • Start date Start date
J

JobHunter69

Guest
If I do something like:

Code:
    fetch(...)
    .then((res) => {
        console.log(res.text(), res.text())
    })

I'll get: Failed to execute 'text' on 'Response': body stream already read

Why does the readablestream get locked? I don't get the reasoning behind disallowing this

<p>If I do something like:</p>
<pre><code> fetch(...)
.then((res) => {
console.log(res.text(), res.text())
})
</code></pre>
<p>I'll get: Failed to execute 'text' on 'Response': body stream already read</p>
<p>Why does the readablestream get locked? I don't get the reasoning behind disallowing this</p>
 

Latest posts

Top