Skip to content

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

Import postman variables correctly (#1142)

Scott Duttonda5fdd54bd75
diff --git a/components/collections/import-export-collections.vue b/components/collections/import-export-collections.vue
index 93b91b9fb..3a89735c4 100644
--- a/components/collections/import-export-collections.vue
+++ b/components/collections/import-export-collections.vue
@@ -139,6 +139,8 @@ export default {
// Do nothing
}
} else if (collections.info && collections.info.schema.includes("v2.1.0")) {
+ //replace the variables, postman uses {{var}}, Hoppscotch uses <<var>>
+ collections = JSON.parse(content.replaceAll(/{{([a-z]+)}}/gi, '<<$1>>'))
collections = this.parsePostmanCollection(collections)
} else {
return this.failedImport()