on 11 Apr 2023 03:17 PM
You can use the below Sample Post Execution script JavaScript Code to retrieve the 'Set-Cookie' header on Synthetic HTTP monitors.
var cookies = response.getHeaders().getAll('Set-Cookie');
var setcookie2 = cookies.get(1); //index-1
api.setValue("Set-Cookie", setcookie2);
var cookieslength = cookies.size();
api.info("cookies length " + cookieslength);
for(i=0;i<cookieslength;i++)
{
cookie = cookies.get(i);
api.info( i + ". cookie: " + cookie);
}