From f0c31252278a2d77bc59cbbc6a61178d66156017 Mon Sep 17 00:00:00 2001 From: Sahil Khan <112230611+sahell0x@users.noreply.github.com> Date: Thu, 6 Feb 2025 20:23:27 +0530 Subject: [PATCH] fix:handle render svg response (#3833) --- packages/bruno-app/src/utils/common/codemirror.js | 4 ++-- packages/bruno-app/src/utils/common/index.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/utils/common/codemirror.js b/packages/bruno-app/src/utils/common/codemirror.js index 82b98a325..661b84433 100644 --- a/packages/bruno-app/src/utils/common/codemirror.js +++ b/packages/bruno-app/src/utils/common/codemirror.js @@ -159,6 +159,8 @@ export const getCodeMirrorModeBasedOnContentType = (contentType, body) => { if (contentType.includes('json')) { return 'application/ld+json'; + } else if (contentType.includes('image')) { + return 'application/image'; } else if (contentType.includes('xml')) { return 'application/xml'; } else if (contentType.includes('html')) { @@ -169,8 +171,6 @@ export const getCodeMirrorModeBasedOnContentType = (contentType, body) => { return 'application/xml'; } else if (contentType.includes('yaml')) { return 'application/yaml'; - } else if (contentType.includes('image')) { - return 'application/image'; } else { return 'application/text'; } diff --git a/packages/bruno-app/src/utils/common/index.js b/packages/bruno-app/src/utils/common/index.js index 1244966b7..f9f1c7fbe 100644 --- a/packages/bruno-app/src/utils/common/index.js +++ b/packages/bruno-app/src/utils/common/index.js @@ -94,6 +94,8 @@ export const getContentType = (headers) => { if (contentType && contentType.length) { if (typeof contentType[0] == 'string' && /^[\w\-]+\/([\w\-]+\+)?json/.test(contentType[0])) { return 'application/ld+json'; + } else if (typeof contentType[0] === 'string' && /^image\/svg\+xml/i.test(contentType[0])) { + return 'image/svg+xml'; } else if (typeof contentType[0] == 'string' && /^[\w\-]+\/([\w\-]+\+)?xml/.test(contentType[0])) { return 'application/xml'; }