Merge pull request #711 from survivant/feature/pre-req-and-test

Added pre-request and tests scripts support from Postman Collection
This commit is contained in:
Anoop M D 2023-10-22 16:23:19 +05:30 committed by GitHub
commit 82c6e83d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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