Merge pull request #1054 from shourav9884/feature/response-time-in-response

feat(#1050): Response time in res
This commit is contained in:
Anoop M D 2023-11-25 23:22:57 +05:30 committed by GitHub
commit 3b77cfb8d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 0 deletions

View File

@ -27,10 +27,12 @@ if (!SERVER_RENDERED) {
'res.statusText',
'res.headers',
'res.body',
'res.responseTime',
'res.getStatus()',
'res.getHeader(name)',
'res.getHeaders()',
'res.getBody()',
'res.getResponseTime()',
'req',
'req.url',
'req.method',

View File

@ -210,6 +210,8 @@ const runSingleRequest = async function (
}
}
response.responseTime = responseTime;
console.log(
chalk.green(stripExtension(filename)) +
chalk.dim(` (${response.status} ${response.statusText}) - ${responseTime} ms`)

View File

@ -446,6 +446,8 @@ const registerNetworkIpc = (mainWindow) => {
const { data, dataBuffer } = parseDataFromResponse(response);
response.data = data;
response.responseTime = responseTime;
// save cookies
let setCookieHeaders = [];
if (response.headers['set-cookie']) {

View File

@ -5,6 +5,7 @@ class BrunoResponse {
this.statusText = res ? res.statusText : null;
this.headers = res ? res.headers : null;
this.body = res ? res.data : null;
this.responseTime = res ? res.responseTime : null;
}
getStatus() {
@ -22,6 +23,10 @@ class BrunoResponse {
getBody() {
return this.res ? this.res.data : null;
}
getResponseTime() {
return this.res ? this.res.responseTime : null;
}
}
module.exports = BrunoResponse;

View File

@ -109,6 +109,7 @@ const createResponseParser = (response = {}) => {
res.statusText = response.statusText;
res.headers = response.headers;
res.body = response.data;
res.responseTime = response.responseTime;
res.jq = (expr) => {
const output = jsonQuery(expr, { data: response.data });