I want to set a cookie for a test, which I try to do via a pre-request script.
I have set an environment variable for the value I want to set (on multiple tests) and have this pre-request script:
const cookieJar = pm.cookies.jar();
authcookie = pm.environment.get(âauth-cookieâ);
console.log(authcookie);
cookieJar.clear(âhttps://myserver.com/â, function (error) { console.log(error); });
cookieJar.set(âhttps://myserver.com/â,
{ ânameâ: âPHPSESSIDâ, âvalueâ: authcookie, âhttpOnlyâ: false },
function (error, cookie) { console.log(error); });
When I run the script, I get this error which I have no idea how to solve:
Object {message: âCookieStore: programmatic access to âmyserver.comâ is deniedâ, name: âErrorâ, type: âErrorâ}
- message: âCookieStore: programmatic access to âmyserver.comâ is deniedâ
- name: âErrorâ
- type: âErrorâ
Any idea how to solve that?
Update: I am trying this in the Postman app on mac.