I have created a Scripted API type monitor to check whether file getting download or not. Below is my script.
var assert = require(‘assert’);
assert.ok(res.statusCode==200,‘Expected 200 response but received:’ +res.statusCode);
Daily I am getting twice or thrice this error TypeError:Cannot read property ‘statusCode’ of undefined.
But during this time when I manually checked I am getting 200 response but not sure why it throws error like this even though it had response .Please help me on this or please tell solution to add in my script.