Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lib/run/summary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var _ = require('lodash'),
sdk = require('postman-collection'),
SerialiseError = require('serialised-error'),
RunSummary;
RunSummary,
_responseTruncateLimit = Infinity;

/**
* Creates and returns a RunSummary instance for the current collection run.
Expand All @@ -14,6 +15,9 @@ RunSummary = function RunSummary (emitter, options) {
// keep a copy of this instance since, we need to refer to this from various events
var summary = this;

// Set responseTruncateLimit
_responseTruncateLimit = _.get(options, 'responseTruncateLimit', _responseTruncateLimit);

// and store the trackers and failures in the summary object itself
_.assign(summary, /** @lends RunSummary.prototype */ {
/**
Expand Down Expand Up @@ -225,10 +229,20 @@ _.assign(RunSummary, {

var execution = cache[o.cursor.ref] = (cache[o.cursor.ref] || {});

// Copy response object
let response = {};

_.assign(response, o.response);

// Truncate large response body
if (_.get(response, 'stream') && response.stream.length > _responseTruncateLimit) {
response.stream = response.stream.slice(0, _responseTruncateLimit);
}

executions.push(_.assignIn(execution, {
cursor: o.cursor,
request: o.request,
response: o.response,
response: response,
id: _.get(o, 'item.id')
}, err && {
requestError: err || undefined
Expand Down
Loading