Skip to content

Commit

Permalink
fix: only JSON.parse if there is output
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jan 31, 2019
1 parent 53ee1d3 commit ba46ef8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function send(method, uri, opts={}) {

r.on('end', () => {
let type = r.headers['content-type'];
if (type && type.includes('application/json')) {
if (type && out && type.includes('application/json')) {
out = JSON.parse(out);
}
r.data = out;
Expand Down

0 comments on commit ba46ef8

Please sign in to comment.