diff --git a/lib/index.js b/lib/index.js index e34b166..fdf1c8f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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;