mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-12-02 11:47:57 +08:00
29 lines
885 B
JavaScript
29 lines
885 B
JavaScript
let _LibsFlowCommon = require('../src/workbench/node/request/unit.js');
|
|
let _LibsCommon = require('../src/workbench/node/request/libs/common.js');
|
|
|
|
module.exports = (req, res) => {
|
|
console.log('unit.js', req.body);
|
|
try {
|
|
let reqJSON = req.body.data;
|
|
reqJSON.env = _LibsCommon.parseEnv(reqJSON.env);
|
|
new _LibsFlowCommon.core().main(reqJSON).then(({ globals,report, history }) => {
|
|
['general', 'requestInfo', 'resultInfo'].forEach((keyName) => {
|
|
if (typeof history[keyName] === 'string') history[keyName] = JSON.parse(history[keyName]);
|
|
});
|
|
res.send(
|
|
JSON.stringify({
|
|
action: 'finish',
|
|
data: {
|
|
id: req.body.id,
|
|
globals:globals,
|
|
report: report,
|
|
history: history,
|
|
},
|
|
})
|
|
);
|
|
});
|
|
} catch (e) {
|
|
console.error('unit.js', e, req.body);
|
|
}
|
|
};
|