Skip to content

Commit

Permalink
Merge pull request #1 from kunagpal/patch-2
Browse files Browse the repository at this point in the history
Fixed issue with undefined response bodies
  • Loading branch information
mbaeuerle authored May 18, 2017
2 parents 220ffa7 + b343087 commit 6bb5a6e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ class PhpUnitStyleReporter {
this.writeRed('F');
const msg = this.currItem.failedAssertions.join(", ");
const details = `${this.currItem.response.code}, reason: ${this.currItem.response.reason()}`;
let body;
try {
body = JSON.parse(this.currItem.response.body);
} catch (e) {
body = this.currItem.response.body;
}
let body = this.currItem.response.stream.toString(); // response.stream is a buffer
try {
body = JSON.parse(body);
} catch (e) {}

let failure = new Object();
failure.item = this.currItem;
failure.msg = msg;
Expand Down

0 comments on commit 6bb5a6e

Please sign in to comment.