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

Commit 99f2437

Browse files
authored
Merge pull request #359 from ipfs/fix/http-api-doesnt-care
fix(block): cope with the fact that sometimes go-ipfs sends x-stream,…
2 parents 5e12aa6 + 5e0ede9 commit 99f2437

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/api/block.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ module.exports = (send) => {
1919
if (err) {
2020
return callback(err)
2121
}
22-
res.pipe(bl((err, data) => {
23-
if (err) {
24-
return callback(err)
25-
}
26-
callback(null, new Block(data))
27-
}))
22+
if (Buffer.isBuffer(res)) {
23+
callback(null, new Block(res))
24+
} else {
25+
res.pipe(bl((err, data) => {
26+
if (err) {
27+
return callback(err)
28+
}
29+
callback(null, new Block(data))
30+
}))
31+
}
2832
})
2933
}),
3034
stat: promisify((args, opts, callback) => {

0 commit comments

Comments
 (0)