从 Newman 调用中合并发送和下载邮递员选项的机制是什么
What is the mechanism to incorporate send and download postman option from within Newman call
在 Newman 调用中合并发送和下载 postman 选项的机制是什么?
我的 REST 调用的输出是文件 (image/binary)。在 运行 Newman 上,我没有看到输出。有没有办法把内容保存到文件中呢
目前纽曼还没有这个功能。但您可以有一个变通方法,您可以在其中读取输出流并将其写入所需位置的文件中。
附加示例代码:
var i = 0,
fs = require('fs'),
newman = require('newman'); // ensure that you have run "npm i newman" in the same directory as this file
newman.run({
// run options go here
}, function (err, summary) {
// handle collection run err, process the run summary here
}).on('request', function (err, execution) { // This is triggered when a response has been recieved
if (err) { return console.error(err); }
fs.writeFile(`response${i++}.txt`, execution.response.stream, function (error) {
if (error) { console.error(error); }
});
});
在 Newman 调用中合并发送和下载 postman 选项的机制是什么?
我的 REST 调用的输出是文件 (image/binary)。在 运行 Newman 上,我没有看到输出。有没有办法把内容保存到文件中呢
目前纽曼还没有这个功能。但您可以有一个变通方法,您可以在其中读取输出流并将其写入所需位置的文件中。 附加示例代码:
var i = 0,
fs = require('fs'),
newman = require('newman'); // ensure that you have run "npm i newman" in the same directory as this file
newman.run({
// run options go here
}, function (err, summary) {
// handle collection run err, process the run summary here
}).on('request', function (err, execution) { // This is triggered when a response has been recieved
if (err) { return console.error(err); }
fs.writeFile(`response${i++}.txt`, execution.response.stream, function (error) {
if (error) { console.error(error); }
});
});