Skip to content

Commit

Permalink
fix(body): throw error when body already used
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgw committed Aug 27, 2019
1 parent f7de954 commit e78484d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class Request extends _fetch.Request {
if (this[_bodyError]) {
throw this[_bodyError]
}
if (this.bodyUsed) {
throw new TypeError(`body used already for: ${this.url}`)
}
super.buffer()
}

Expand Down Expand Up @@ -124,6 +127,9 @@ class Response extends _fetch.Response {
if (this[_bodyError]) {
throw this[_bodyError]
}
if (this.bodyUsed) {
throw new TypeError(`body used already for: ${this.url}`)
}
super.buffer()
}

Expand Down

0 comments on commit e78484d

Please sign in to comment.