From e7e76ad4247dcfe091edb0049e8fcb65ed3b7325 Mon Sep 17 00:00:00 2001 From: Martin Brocker Date: Wed, 24 Apr 2024 16:46:57 +0200 Subject: [PATCH] Allow for beautification of custom json header Allow requests which contain custom application header for json to be parsed and displayed in a nice format This assist for cases for example, FHIR data "application/fhir+json". --- app/scripts/utils/utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/scripts/utils/utils.js b/app/scripts/utils/utils.js index 1b324603..66b7b4b1 100644 --- a/app/scripts/utils/utils.js +++ b/app/scripts/utils/utils.js @@ -60,6 +60,11 @@ export function beautifyIndent (type, content) { if (/.*application\/\w+\+xml.*/.test(type)) { return { lang: 'xml', content: pd.xml(content, 2) } } + + // application/{word characters}+json. + if (/application\/\w+\+json/.test(type)) { + return { lang: 'json', content: pd.json(content, 2) } + } } catch (err) { console.log(err) return { lang: '', content }