From 8197458a4bb32da1737e13bff4d0010a3be3a119 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Fri, 25 Mar 2022 13:43:16 +0530 Subject: [PATCH] refactor: reorganize body evaluation a bit --- .../helpers/import-export/import/postman.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-app/helpers/import-export/import/postman.ts b/packages/hoppscotch-app/helpers/import-export/import/postman.ts index 276eca9d2..07e291787 100644 --- a/packages/hoppscotch-app/helpers/import-export/import/postman.ts +++ b/packages/hoppscotch-app/helpers/import-export/import/postman.ts @@ -218,17 +218,17 @@ const getHoppReqBody = (item: Item): HoppRESTReqBody => { ), // Back-up plan, assume language from raw language defintion - // If that too failed, just assume "text/plain" - O.getOrElse(() => + O.alt(() => pipe( body.options?.raw?.language, O.fromNullable, - O.map((lang) => PMRawLanguageOptionsToContentTypeMap[lang]), - - O.getOrElse((): ValidContentTypes => "text/plain") + O.map((lang) => PMRawLanguageOptionsToContentTypeMap[lang]) ) ), + // If that too failed, just assume "text/plain" + O.getOrElse((): ValidContentTypes => "text/plain"), + O.of ) ),