Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response.clone() still throwing this stream has already been locked #16

Open
alvaroraminelli opened this issue Jun 2, 2023 · 0 comments

Comments

@alvaroraminelli
Copy link

Hello Team,

Looks like response.clone() does not work as expected when trying to re-read the response.

const myRequest = new Request('https://restcountries.com/v3.1/region/europe');

fetch(myRequest)
  .then((response) => {
    const response2 = response.clone();

    response.json().then((myRes) => {
      console.log('Response', myRes);
    });

    response2
      .json()
      .then((myRes) => {
        console.log('Response2 --->', myRes);
      })
      .catch((e) => {
        console.log('@@@@@@');
        console.log(e);
        console.log('@@@@@@');
      });
  });
@@@@@@
[TypeError: This stream has already been locked for exclusive reading by another reader]
@@@@@@```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant