diff --git a/packages/bruno-app/src/components/ResponsePane/ResponseHeaders/index.js b/packages/bruno-app/src/components/ResponsePane/ResponseHeaders/index.js index f18a5f947..9964a5f4b 100644 --- a/packages/bruno-app/src/components/ResponsePane/ResponseHeaders/index.js +++ b/packages/bruno-app/src/components/ResponsePane/ResponseHeaders/index.js @@ -2,6 +2,8 @@ import React from 'react'; import StyledWrapper from './StyledWrapper'; const ResponseHeaders = ({ headers }) => { + const headersArray = typeof headers === 'object' ? Object.entries(headers) : []; + return ( @@ -12,8 +14,8 @@ const ResponseHeaders = ({ headers }) => { - {headers && headers.length - ? headers.map((header, index) => { + {headersArray && headersArray.length + ? headersArray.map((header, index) => { return ( diff --git a/packages/bruno-app/src/components/ResponsePane/Timeline/index.js b/packages/bruno-app/src/components/ResponsePane/Timeline/index.js index 135627b16..d8a4770a5 100644 --- a/packages/bruno-app/src/components/ResponsePane/Timeline/index.js +++ b/packages/bruno-app/src/components/ResponsePane/Timeline/index.js @@ -5,7 +5,7 @@ import StyledWrapper from './StyledWrapper'; const Timeline = ({ request, response }) => { const requestHeaders = []; - const responseHeaders = response.headers || []; + const responseHeaders = typeof response.headers === 'object' ? Object.entries(response.headers) : []; request = request || {}; response = response || {}; diff --git a/packages/bruno-app/src/utils/network/index.js b/packages/bruno-app/src/utils/network/index.js index ffd66743f..4ee055fda 100644 --- a/packages/bruno-app/src/utils/network/index.js +++ b/packages/bruno-app/src/utils/network/index.js @@ -10,7 +10,7 @@ export const sendNetworkRequest = async (item, collection, environment, collecti data: response.data, // Note that the Buffer is encoded as a base64 string, because Buffers / TypedArrays are not allowed in the redux store dataBuffer: response.dataBuffer, - headers: Object.entries(response.headers), + headers: response.headers, size: response.size, status: response.status, statusText: response.statusText, diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index eb61d62d6..58e7dc638 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -792,7 +792,7 @@ const registerNetworkIpc = (mainWindow) => { responseReceived: { status: response.status, statusText: response.statusText, - headers: Object.entries(response.headers), + headers: response.headers, duration: timeEnd - timeStart, dataBuffer: dataBuffer.toString('base64'), size: Buffer.byteLength(dataBuffer), @@ -809,7 +809,7 @@ const registerNetworkIpc = (mainWindow) => { response = { status: error.response.status, statusText: error.response.statusText, - headers: Object.entries(error.response.headers), + headers: error.response.headers, duration: timeEnd - timeStart, dataBuffer: dataBuffer.toString('base64'), size: Buffer.byteLength(dataBuffer),
{header[0]}