diff --git a/packages/bruno-app/src/utils/importers/postman-collection.js b/packages/bruno-app/src/utils/importers/postman-collection.js index 7fd36dad2..acb018d9d 100644 --- a/packages/bruno-app/src/utils/importers/postman-collection.js +++ b/packages/bruno-app/src/utils/importers/postman-collection.js @@ -62,6 +62,23 @@ const importPostmanV2CollectionItem = (brunoParent, item) => { } }; + if (i.event) { + i.event.forEach((event) => { + if (event.listen === 'prerequest' && event.script && event.script.exec) { + if (!brunoRequestItem.request.script) { + brunoRequestItem.request.script = {}; + } + brunoRequestItem.request.script.req = event.script.exec[0]; + } + if (event.listen === 'test' && event.script && event.script.exec) { + if (!brunoRequestItem.request.tests) { + brunoRequestItem.request.tests = {}; + } + brunoRequestItem.request.tests = event.script.exec[0]; + } + }); + } + const bodyMode = get(i, 'request.body.mode'); if (bodyMode) { if (bodyMode === 'formdata') {