Skip to content

Commit

Permalink
fix: don't re-parse parsed JSON (#543)
Browse files Browse the repository at this point in the history
* fix: don't re-parse parsed JSON

* oops
  • Loading branch information
eshanholtz committed Mar 9, 2020
1 parent 6266910 commit 747a091
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/base/RestException.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var util = require('util');
function RestException(response) {
Error.call('[HTTP ' + response.statusCode + '] Failed to execute request');

var body = JSON.parse(response.body);
var body = response.body;
this.status = response.statusCode;
this.message = body.message;
this.code = body.code;
Expand Down
6 changes: 3 additions & 3 deletions lib/base/Version.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Version.prototype.fetch = function(opts) {
throw new RestException(response);
}

return JSON.parse(response.body);
return response.body;
}
);

Expand All @@ -85,7 +85,7 @@ Version.prototype.update = function(opts) {
throw new RestException(response);
}

return JSON.parse(response.body);
return response.body;
}
);

Expand Down Expand Up @@ -129,7 +129,7 @@ Version.prototype.create = function(opts) {
throw new RestException(response);
}

return JSON.parse(response.body);
return response.body;
}
);

Expand Down

0 comments on commit 747a091

Please sign in to comment.