Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: handle unknown raw language option

Rishabh Agarwal86803dc2bea1
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),