I鈥檓 afraid this is by design. The body is not retained since it can get too big for most cases and cause things to crash.
Newman stores report on memory until end when it flushes it to disk. This behaviour needs to change before adding this feature.
Thanks for the quick response :)
Maybe it can be limited to only log the body of requests that failed a test. My intention is to debug failed requests a little bit better.
Maybe it can be limited to only log the body of requests that failed a test. My intention is to debug failed requests a little bit better.
That would be good. I saw other posts suggesting adding console.log() to the tests but my test suite is over 1000 test cases and it is unpractical.
Add your console.log to the test script of collection. As such adding one script will make it run for all responses. @luizfzs
Here's a workaround I've used to report the response body of failing tests:
pm.test(`${request.method} -- ${request.name} -- Expect response code to be 200`, () => {
if (pm.response.code !== 200) {
throw new Error(`Response Code: ${pm.response.code} | Response Body: ${pm.response.text()} | Request Body: ${JSON.stringify(pm.request.body)}`);
}
});
Couldn't you:
1) make a flag to enable/disable/just log failures
3) truncate the response if it's too big
Seems crazy that we have to write custom code to do something as fundamental as log responses from our CI builds.
Should I be working on this issue? Is this a priority issue that needs to be fixed?
Should I be working on this issue? Is this a priority issue that needs to be fixed?
@AswinCG2002 i see you are interested in contributing to a number of issues. To ensure we don't flood every open issue, and have the moderators go through every issue you've commented, find a subset of issues that you think you know what the solution is and comment with the proposed solution. That will help start a dialogue to completion.
Thanks for understanding.
Most helpful comment
Thanks for the quick response :)
Maybe it can be limited to only log the body of requests that failed a test. My intention is to debug failed requests a little bit better.