Skip to content

Commit

Permalink
fix(body): default to null body
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgw committed Aug 28, 2019
1 parent 379f55b commit e5bd3b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Request extends _fetch.Request {
class Response extends _fetch.Response {
constructor (body, init, bodyError) {
const buffer = parseBody(body)
super(createStream(buffer), init)
super(body ? createStream(buffer) : null, init)
defineBuffer(this, buffer)
if (bodyError) defineBodyError(this, bodyError)
}
Expand Down Expand Up @@ -169,7 +169,7 @@ function checkBody (body) {

function consumeBody (body) {
_super(body, 'buffer')().catch(error => console.error(error))
return body[_body]
return body[_body] || Buffer.alloc(0)
}

function deserializeResponse (body, init, bodyError) {
Expand Down

0 comments on commit e5bd3b2

Please sign in to comment.