Skip to content

request.clone() doesn't preserve the original request #308

Closed
@wmadden

Description

@wmadden

The purpose of the clone() method is to allow reuse of the (normally single-use) Body of the request. Unfortunately, the implementation in this polyfill doesn't allow that.

To illustrate the problem, this example code will fail:

var r1 = new Request('http://somewhere.com', { method: 'POST', body: 'test' });
var r2 = r1.clone();
r1.text(); // --> fails - but should succeed
r2.text(); // --> succeeds

The clone() method in this polyfill just delegates to the constructor, but the constructor is supposed to consume the stream of the original request (which it does), and the clone() method is supposed to leave it untouched.

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