mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-22 13:48:41 +01:00
fix: getContentType function and save file logic update (#1499)
This commit is contained in:
parent
72fde80577
commit
7b6c72c63b
@ -83,8 +83,10 @@ export const normalizeFileName = (name) => {
|
||||
};
|
||||
|
||||
export const getContentType = (headers) => {
|
||||
if (headers && headers.length) {
|
||||
let contentType = headers
|
||||
const headersArray = typeof headers === 'object' ? Object.entries(headers) : [];
|
||||
|
||||
if (headersArray.length > 0) {
|
||||
let contentType = headersArray
|
||||
.filter((header) => header[0].toLowerCase() === 'content-type')
|
||||
.map((header) => {
|
||||
return header[1];
|
||||
|
@ -946,8 +946,10 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
ipcMain.handle('renderer:save-response-to-file', async (event, response, url) => {
|
||||
try {
|
||||
const getHeaderValue = (headerName) => {
|
||||
if (response.headers) {
|
||||
const header = response.headers.find((header) => header[0] === headerName);
|
||||
const headersArray = typeof response.headers === 'object' ? Object.entries(response.headers) : [];
|
||||
|
||||
if (headersArray.length > 0) {
|
||||
const header = headersArray.find((header) => header[0] === headerName);
|
||||
if (header && header.length > 1) {
|
||||
return header[1];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user