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.