Skip to content

Commit ab2d378

Browse files
committed
handle native error strings
1 parent ae4d807 commit ab2d378

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ const fetch = (url, obj, callback) => {
2222

2323
let data = err || res;
2424

25+
if (typeof data === 'string') {
26+
data = { bodyString: data }
27+
}
28+
2529
data.json = function() {
2630
return Q.fcall(function() {
2731
return JSON.parse(data.bodyString);

0 commit comments

Comments
 (0)