Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #359 from ipfs/fix/http-api-doesnt-care
Browse files Browse the repository at this point in the history
fix(block): cope with the fact that sometimes go-ipfs sends x-stream,…
  • Loading branch information
daviddias authored Aug 24, 2016
2 parents 5e12aa6 + 5e0ede9 commit 99f2437
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/api/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ module.exports = (send) => {
if (err) {
return callback(err)
}
res.pipe(bl((err, data) => {
if (err) {
return callback(err)
}
callback(null, new Block(data))
}))
if (Buffer.isBuffer(res)) {
callback(null, new Block(res))
} else {
res.pipe(bl((err, data) => {
if (err) {
return callback(err)
}
callback(null, new Block(data))
}))
}
})
}),
stat: promisify((args, opts, callback) => {
Expand Down

0 comments on commit 99f2437

Please sign in to comment.