mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-02 10:59:22 +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) => {
|
export const getContentType = (headers) => {
|
||||||
if (headers && headers.length) {
|
const headersArray = typeof headers === 'object' ? Object.entries(headers) : [];
|
||||||
let contentType = headers
|
|
||||||
|
if (headersArray.length > 0) {
|
||||||
|
let contentType = headersArray
|
||||||
.filter((header) => header[0].toLowerCase() === 'content-type')
|
.filter((header) => header[0].toLowerCase() === 'content-type')
|
||||||
.map((header) => {
|
.map((header) => {
|
||||||
return header[1];
|
return header[1];
|
||||||
|
@ -946,8 +946,10 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
ipcMain.handle('renderer:save-response-to-file', async (event, response, url) => {
|
ipcMain.handle('renderer:save-response-to-file', async (event, response, url) => {
|
||||||
try {
|
try {
|
||||||
const getHeaderValue = (headerName) => {
|
const getHeaderValue = (headerName) => {
|
||||||
if (response.headers) {
|
const headersArray = typeof response.headers === 'object' ? Object.entries(response.headers) : [];
|
||||||
const header = response.headers.find((header) => header[0] === headerName);
|
|
||||||
|
if (headersArray.length > 0) {
|
||||||
|
const header = headersArray.find((header) => header[0] === headerName);
|
||||||
if (header && header.length > 1) {
|
if (header && header.length > 1) {
|
||||||
return header[1];
|
return header[1];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user