Skip to content

clone() seems not to be working properly. #128

Description

@Stradex

This is mostly for any future user since I believe this is discontinued:

With fetch I use clone() to being able to call .json() or .text() more than once, typical example:

const res = await fetch(url, {method: 'POST', body: JSON.stringify(myBody), headers });
let fetchResData = null;
try {
  fetchResData = await res.clone().json();
} catch (e) {
  fetchResData = await res.text();
}

Doing that with regular fetch works, but you it does not work with this HTTP2 fetch. You will receive a "Body already used" error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions