fix: preserve request name when importing cURL commands (#5337)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Anwarul Islam 2025-08-19 20:57:53 +06:00 committed by GitHub
parent 24c0f9370b
commit 3994d9e9a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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")}`)