cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mareeswaran
Dynatrace Helper
Dynatrace Helper

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);
}
Version history
Last update:
‎11 Apr 2023 03:17 PM
Updated by:
Comments
ChadTurner
DynaMight Legend
DynaMight Legend

Thank you @Mareeswaran for sharing this!