mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
Merge pull request #1054 from shourav9884/feature/response-time-in-response
feat(#1050): Response time in res
This commit is contained in:
commit
3b77cfb8d6
@ -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',
|
||||
|
@ -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`)
|
||||
|
@ -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']) {
|
||||
|
@ -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;
|
||||
|
@ -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 });
|
||||
|
Loading…
Reference in New Issue
Block a user