Skip to content

Commit

Permalink
replaced error with response object
Browse files Browse the repository at this point in the history
  • Loading branch information
naman-bruno committed Jan 22, 2025
1 parent 65fe07f commit 2108bf5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/bruno-electron/src/ipc/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,16 @@ const configureRequest = async (
async error => {
if (error.response && [301, 302, 303, 307, 308].includes(error.response.status)) {
if (redirectCount >= MAX_REDIRECTS) {
return Promise.reject(new Error('Too many redirects'));
const dataBuffer = Buffer.from(error.response.data);
return {
status: error.response.status,
statusText: error.response.statusText,
headers: error.response.headers,
data: error.response.data,
dataBuffer: dataBuffer.toString('base64'),
size: Buffer.byteLength(dataBuffer),
duration: error.response.headers.get('request-duration') ?? 0
};
}
redirectCount++;

Expand Down

0 comments on commit 2108bf5

Please sign in to comment.