feat: introduce res.getSize() helper (header/body/total) (#5018)

* feat: introduce `res.getSize()` helper (header/body/total)

* fix: unit test

* rm: request-duration from collection runner header

* change: api for getSize

* fix

* improve: getSize method

* add: todo comment

---------

Co-authored-by: lohit <lohit@usebruno.com>
This commit is contained in:
Pooja
2025-07-08 21:00:05 +05:30
committed by GitHub
parent 82f5f9ee88
commit fbc77fc725
10 changed files with 149 additions and 10 deletions

View File

@@ -415,8 +415,9 @@ const runSingleRequest = async function (
/** @type {import('axios').AxiosResponse} */
response = await axiosInstance(request);
const { data } = parseDataFromResponse(response, request.__brunoDisableParsingResponseJson);
const { data, dataBuffer } = parseDataFromResponse(response, request.__brunoDisableParsingResponseJson);
response.data = data;
response.dataBuffer = dataBuffer;
// Prevents the duration on leaking to the actual result
responseTime = response.headers.get('request-duration');
@@ -428,8 +429,9 @@ const runSingleRequest = async function (
}
} catch (err) {
if (err?.response) {
const { data } = parseDataFromResponse(err?.response);
const { data, dataBuffer } = parseDataFromResponse(err?.response);
err.response.data = data;
err.response.dataBuffer = dataBuffer;
response = err.response;
// Prevents the duration on leaking to the actual result