Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added variable to track the downloaded content size in response #1426

Merged
merged 8 commits into from
Jul 30, 2024
Merged
5 changes: 4 additions & 1 deletion CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
unreleased:
fixed bugs:
- Fixed a bug where errors from `pm.sendRequest` were not transmitted correctly
- >-
GH-1433 Fixed a bug where errors from `pm.sendRequest` were not
transmitted correctly
chores:
- GH-1426 Added variable to track the downloaded content size in response
- Updated dependencies

7.40.0:
Expand Down
3 changes: 2 additions & 1 deletion lib/requester/requester.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ class Requester extends EventEmitter {
status: res && res.statusMessage,
header: responseHeaders,
stream: resBody,
responseTime: responseTime
responseTime: responseTime,
downloadedBytes: history.execution.data[0].response.downloadedBytes
});

onComplete(RESPONSE_END, response, history);
Expand Down
3 changes: 2 additions & 1 deletion lib/runner/extensions/item.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ getResponseJSON = function (response) {
type: 'Base64',
data: response.stream.toString('base64')
},
responseTime: response.responseTime
responseTime: response.responseTime,
downloadedBytes: response.downloadedBytes
};
};

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"node-oauth1": "1.3.0",
"performance-now": "2.1.0",
"postman-collection": "4.4.1",
"postman-request": "2.88.1-postman.34",
"postman-request": "2.88.1-postman.36",
"postman-sandbox": "5.1.0",
"postman-url-encoder": "3.0.5",
"serialised-error": "1.1.3",
Expand Down
3 changes: 3 additions & 0 deletions test/integration-legacy/requester-spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4606,6 +4606,9 @@ describe('Requester', function () {
expect(response).to.have.property('code', 200);
expect(response.text()).to.equal('thisisagzippedresponse');
expect(request).to.be.ok;
expect(response.size()).to.eql({
body: 42, header: 173, total: 215
});
});
},
done (err) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/requester-spec/history.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ var expect = require('chai').expect,
expect(executionData.request).to.be.an('object')
.that.has.all.keys(['headers', 'href', 'httpVersion', 'method', 'proxy']);
expect(executionData.response).to.be.an('object')
.that.has.all.keys(['headers', 'httpVersion', 'statusCode']);
.that.has.all.keys(['headers', 'httpVersion', 'statusCode', 'downloadedBytes']);
});
});
});
Loading