diff --git a/packages/bruno-app/src/utils/importers/postman-collection.js b/packages/bruno-app/src/utils/importers/postman-collection.js index 3f10aea9cf..b812872145 100644 --- a/packages/bruno-app/src/utils/importers/postman-collection.js +++ b/packages/bruno-app/src/utils/importers/postman-collection.js @@ -59,7 +59,8 @@ let translationLog = {}; const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) => { brunoParent.items = brunoParent.items || []; const folderMap = {}; - + const requestMap = {}; + each(item, (i) => { if (isItemAFolder(i)) { const baseFolderName = i.name; @@ -84,6 +85,15 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) = } } else { if (i.request) { + const baseRequestName = i.name; + let requestName = baseRequestName; + let count = 1; + + while (requestMap[requestName]) { + requestName = `${baseRequestName}_${count}`; + count++; + } + let url = ''; if (typeof i.request.url === 'string') { url = i.request.url; @@ -93,7 +103,7 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) = const brunoRequestItem = { uid: uuid(), - name: i.name, + name: requestName, type: 'http-request', request: { url: url, @@ -308,6 +318,7 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) = }); brunoParent.items.push(brunoRequestItem); + requestMap[requestName] = brunoRequestItem; } } });