Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incorrect set of bodyUsed flag when cloning a request #440

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions fetch.js
Expand Up @@ -299,7 +299,7 @@
return (methods.indexOf(upcased) > -1) ? upcased : method
}

function Request(input, options) {
function Request(input, options, isCloneOperation) {
options = options || {}
var body = options.body

Expand All @@ -318,7 +318,9 @@
this.mode = input.mode
if (!body && input._bodyInit != null) {
body = input._bodyInit
input.bodyUsed = true
if (!isCloneOperation) {
input.bodyUsed = true
}
}
}

Expand All @@ -337,7 +339,7 @@
}

Request.prototype.clone = function() {
return new Request(this, { body: this._bodyInit })
return new Request(this, { body: this._bodyInit }, true)
}

function decode(body) {
Expand Down