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: preserve request name when importing cURL commands (#5337)

Anwarul Islam3994d9e9a07e
diff --git a/packages/hoppscotch-common/src/components/http/ImportCurl.vue b/packages/hoppscotch-common/src/components/http/ImportCurl.vue
index ff2c17380..93057b313 100644
--- a/packages/hoppscotch-common/src/components/http/ImportCurl.vue
+++ b/packages/hoppscotch-common/src/components/http/ImportCurl.vue
@@ -149,7 +149,11 @@ const handleImport = () => {
if (tabs.currentActiveTab.value.document.type === "example-response") return
- tabs.currentActiveTab.value.document.request = req
+ // Preserve the existing request name when importing cURL
+ const currentRequest = tabs.currentActiveTab.value.document.request
+ const reqName = currentRequest?.name ?? req.name
+
+ tabs.currentActiveTab.value.document.request = { ...req, name: reqName }
} catch (e) {
console.error(e)
toast.error(`${t("error.curl_invalid_format")}`)