Skip to content

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

Open
@alvaroraminelli

Description

@alvaroraminelli

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]
@@@@@@```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions