// The opts for the server, also includes the data to be written to file
let opts = {
requestName: request.name || request.url,
fileExtension: ‘json’,
mode: ‘appendFile’, // Change this to any function of the fs library of node to use it.
uniqueIdentifier: false,
responseData: pm.response.text()
};
pm.sendRequest({
url: ‘http://localhost:3000/write’,
method: ‘POST’,
header: ‘Content-Type:application/json’,
body: {
mode: ‘raw’,
raw: pm.response.text()
}
}, function (err, res) {
console.log(res);
});
I am using the above snippet , but the file has only response of first request and i am able to see “Internal Server error” -500 in all the iterations after POST operation
TypeError [ERR_INVALID_ARG_TYPE]: The “data” argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at Object.writeFile (node:fs:2108:5)
The saved file under Responses folder has only response of first request