Skip to content

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

fix: tiny issues with importers

Andrew Bastin1719bb7bc9d8
diff --git a/packages/hoppscotch-app/helpers/import-export/import/insomnia.ts b/packages/hoppscotch-app/helpers/import-export/import/insomnia.ts
index 6c5bf0a82..33083a6c2 100644
--- a/packages/hoppscotch-app/helpers/import-export/import/insomnia.ts
+++ b/packages/hoppscotch-app/helpers/import-export/import/insomnia.ts
@@ -180,7 +180,7 @@ const getHoppReqParams = (req: InsomniaRequestResource): HoppRESTParam[] =>
const getHoppRequest = (req: InsomniaRequestResource): HoppRESTRequest =>
makeRESTRequest({
name: req.name ?? "Untitled Request",
- method: req.method ?? "GET",
+ method: req.method?.toUpperCase() ?? "GET",
endpoint: replaceVarTemplating(req.url ?? ""),
auth: getHoppReqAuth(req),
body: getHoppReqBody(req),
diff --git a/packages/hoppscotch-app/helpers/import-export/import/openapi.ts b/packages/hoppscotch-app/helpers/import-export/import/openapi.ts
index ac3bc4f5d..53721fa80 100644
--- a/packages/hoppscotch-app/helpers/import-export/import/openapi.ts
+++ b/packages/hoppscotch-app/helpers/import-export/import/openapi.ts
@@ -531,8 +531,8 @@ const convertPathToHoppReqs = (
// Construct request object
RA.map(({ method, info }) =>
makeRESTRequest({
- name: info.operationId ?? "Untitled Request",
- method,
+ name: info.operationId ?? info.summary ?? "Untitled Request",
+ method: method.toUpperCase(),
endpoint: `<<baseUrl>>${replaceOpenApiPathTemplating(pathName)}`, // TODO: Make this proper
// We don't need to worry about reference types as the Dereferencing pass should remove them
diff --git a/packages/hoppscotch-app/helpers/import-export/import/postman.ts b/packages/hoppscotch-app/helpers/import-export/import/postman.ts
index 12a7ccdad..2de9659aa 100644
--- a/packages/hoppscotch-app/helpers/import-export/import/postman.ts
+++ b/packages/hoppscotch-app/helpers/import-export/import/postman.ts
@@ -214,7 +214,7 @@ const getHoppRequest = (item: Item): HoppRESTRequest => {
return makeRESTRequest({
name: item.name,
endpoint: getHoppReqURL(item),
- method: item.request.method,
+ method: item.request.method.toUpperCase(),
headers: getHoppReqHeaders(item),
params: getHoppReqParams(item),
auth: getHoppReqAuth(item),