mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
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:
commit
82c6e83d56
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user