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

Commit e8eba1a

Browse files
committed
fix: ensure errors are passed back from stream-to-value
1 parent 9e9cb55 commit e8eba1a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/utils/stream-to-value.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ const concat = require('concat-stream')
77
Concatenate a stream to a single value.
88
*/
99
function streamToValue (response, callback) {
10+
let data
1011
pump(
1112
response,
12-
concat((data) => callback(null, data)),
13-
(err) => {
14-
if (err) {
15-
callback(err)
16-
}
17-
})
13+
concat((d) => { data = d }),
14+
(err) => callback(err, data)
15+
)
1816
}
1917

2018
module.exports = streamToValue

0 commit comments

Comments
 (0)