Added pre-request and tests scripts support from Postman Collection

This commit is contained in:
Sebastien Dionne 2023-10-20 19:02:04 -04:00
parent f8f38802a9
commit fe59cd3223

View File

@ -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') {