From 86803dc2bea107017a9bb34308874e0328f237cf Mon Sep 17 00:00:00 2001 From: Rishabh Agarwal Date: Fri, 18 Mar 2022 16:59:45 +0530 Subject: [PATCH] refactor: handle unknown raw language option --- .../hoppscotch-app/helpers/import-export/import/postman.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-app/helpers/import-export/import/postman.ts b/packages/hoppscotch-app/helpers/import-export/import/postman.ts index 3d544aab0..6f19e7a06 100644 --- a/packages/hoppscotch-app/helpers/import-export/import/postman.ts +++ b/packages/hoppscotch-app/helpers/import-export/import/postman.ts @@ -200,11 +200,12 @@ const getHoppReqBody = (item: Item): HoppRESTReqBody => { getHoppReqHeaders(item).find( ({ key }) => key.toLowerCase() === "content-type" )?.value ?? - PMRawLanguageOptionsToContentTypeMap[ + get( + PMRawLanguageOptionsToContentTypeMap, get(body, "options.raw.language", "text") as PMRawLanguage - ] + ) - if (body.raw !== undefined && body.raw !== null) + if (contentType && body.raw !== undefined && body.raw !== null) return { contentType: contentType as any, body: replacePMVarTemplating(body.raw),