fix(#1810): handled error case responseTime

This commit is contained in:
Anoop M D 2024-04-09 15:05:08 +05:30
parent 5b2ca0ea03
commit fbee23329d
2 changed files with 5 additions and 4 deletions

View File

@ -921,7 +921,7 @@ const registerNetworkIpc = (mainWindow) => {
);
timeStart = Date.now();
let response,responseTime;
let response, responseTime;
try {
/** @type {import('axios').AxiosResponse} */
response = await axiosInstance(request);
@ -929,7 +929,7 @@ const registerNetworkIpc = (mainWindow) => {
const { data, dataBuffer } = parseDataFromResponse(response);
response.data = data;
response.responseTime = response.headers.get('request-duration')
response.responseTime = response.headers.get('request-duration');
mainWindow.webContents.send('main:run-folder-event', {
type: 'response-received',
@ -941,7 +941,7 @@ const registerNetworkIpc = (mainWindow) => {
dataBuffer: dataBuffer.toString('base64'),
size: Buffer.byteLength(dataBuffer),
data: response.data,
responseTime : response.headers.get('request-duration')
responseTime: response.headers.get('request-duration')
},
...eventData
});
@ -959,7 +959,7 @@ const registerNetworkIpc = (mainWindow) => {
dataBuffer: dataBuffer.toString('base64'),
size: Buffer.byteLength(dataBuffer),
data: error.response.data,
responseTime: response.headers.get('request-duration')
responseTime: error.response.headers.get('request-duration')
};
// if we get a response from the server, we consider it as a success

View File

@ -26,6 +26,7 @@ vars:pre-request {
assert {
res.status: eq 200
res.responseTime: lte 2000
~res.body: eq {{pong}}
}