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

Commit 2e67784

Browse files
Merge pull request #218 from xicombd/fix/double-cb-onres
Avoid calling the cb twice when statusCode > 400
2 parents 09d396d + a3ef803 commit 2e67784

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/request-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function onRes (buffer, cb) {
3030
if (res.statusCode >= 400 || !res.statusCode) {
3131
const error = new Error(`Server responded with ${res.statusCode}`)
3232

33-
Wreck.read(res, {json: true}, (err, payload) => {
33+
return Wreck.read(res, {json: true}, (err, payload) => {
3434
if (err) {
3535
return cb(err)
3636
}

0 commit comments

Comments
 (0)