mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
fix(#1810): handled error case responseTime
This commit is contained in:
parent
5b2ca0ea03
commit
fbee23329d
@ -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
|
||||
|
@ -26,6 +26,7 @@ vars:pre-request {
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.responseTime: lte 2000
|
||||
~res.body: eq {{pong}}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user