diff --git a/fetch.js b/fetch.js index 52fdeeff..699cd8a7 100644 --- a/fetch.js +++ b/fetch.js @@ -299,9 +299,7 @@ } Request.prototype.clone = function() { - var newRequest = new Request(this, { body: 'clone' }) - newRequest._initBody(this._bodyInit) - return newRequest + return new Request(this, { body: this._bodyInit }) } function decode(body) { diff --git a/test/test.js b/test/test.js index 36a02874..3454b155 100644 --- a/test/test.js +++ b/test/test.js @@ -494,13 +494,12 @@ suite('Request', function() { test('clone request bodies', function() { var r1 = new Request('https://fetch.spec.whatwg.org/', { method: 'post', - headers: {'content-type': 'text/plain'}, body: 'I work out' }) var r2 = r1.clone() return Promise.all([r1.text(), r2.text()]).then(function(texts){ - return assert.equal(texts[0], texts[1], 'both requests succeed with equal texts') + assert.equal(texts[0], texts[1], 'both requests succeed with equal texts') }) })