Skip to content

Commit c461573

Browse files
committed
fix: return response data even with error status code (only if object)
1 parent a3fc0cb commit c461573

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Modules.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ module.exports = (url, body, storeId, bigTimeout, cb) => {
4747
const { response } = err
4848
debug(response)
4949
if (typeof cb === 'function') {
50-
const data = (response && response.data)
50+
let data
51+
if (response && typeof response.data === 'object' && response.data === null) {
52+
data = response.data
53+
}
5154
cb(err, data)
5255
}
5356

0 commit comments

Comments
 (0)