-
-
Save vdespa/8b2d209867cc10e40939b0ce3696e3c8 to your computer and use it in GitHub Desktop.
const newman = require('newman'); | |
newman.run({ | |
collection: require('./postman_collection.json'), | |
reporters: 'cli' | |
}).on('beforeRequest', function (error, args) { | |
if (error) { | |
console.error(error); | |
} else { | |
// Log the request body | |
console.log(args.request.body.raw); | |
} | |
}).on('request', function (error, args) { | |
if (error) { | |
console.error(error); | |
} | |
else { | |
// Log the response body | |
console.log(args.response.stream.toString()); | |
} | |
}); |
@aaiezza - please see this: https://www.youtube.com/watch?v=cCRmry10874
Thank you @vdespa . This works
i cannot disable the ssl validation althought i have set "insecure: true" in the options..that means i cannot run the request at all. but i can run my collection with followed code:
newman.run({
collection: require('./1.json'), // Path to your Postman collection JSON file
// insecure: true, // Disable SSL certificate verification
reporters: ['cli', 'html'], // Example of reporters
folder: 'web-UGAMASUWRL'
}, function (err) {
if (err) {
console.error('Newman run encountered an error:', err);
process.exit(1);
}
console.log('Newman run complete!');
})
my newman version is: 6.1.3
@LinaLin-Cherrypicks - the line with insecure is still commented. Maybe this is why it does not work as expected.
👍
This is great! Thank you @vdespa!
Do you know though where to place this file or how to tell newman about it?