Skip to content

Commit

Permalink
Feedback fixes from @mislav
Browse files Browse the repository at this point in the history
Simplified/removed unnecessary code
  • Loading branch information
scarlac committed May 27, 2016
1 parent 35ed4c3 commit d108b5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions fetch.js
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions test/test.js
Expand Up @@ -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')
})
})

Expand Down

0 comments on commit d108b5d

Please sign in to comment.