I have a curl command which i am running in postman, i pass a variable with 2 values and i am using the “Write Responses To File” method to get the output in a json file. However when i run my code in collection runner the 2 value data gets override by the 1 value data. Can someone help me with how to not override the data in the file and keep appending to the existing? Below is the code i have in my tests where its generating the file
// The opts for the server, also includes the data to be written to file
let opts = {
requestName: request.name || request.url,
fileExtension: 'json',
mode: 'writeFile', // Change this to any function of the fs library of node to use it.
uniqueIdentifier: 'waddup',
responseData: pm.response.text()
};
pm.sendRequest({
url: 'http://localhost:3000/write',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'raw',
raw: JSON.stringify(opts)
}
}, function (err, res) {
console.log(res);
});