I have a use case’s, where I need to clear cookies after some set of requests.
but when I ran suite, cookies of 1 request is getting stored and the same cookie is being passed automatically in request headers.
this is causing all requests failing.
I used below script to clear the cookie but the cookie is still being stored
const jar = pm.cookies.jar();
jar.getAll(pm.request.url, function (error, cookies) {
// error -
// cookies -
});
jar.clear(pm.request.url, function (error) {
// error -
});
Domain whitelisting doesn’t seem to work in version Version 8.0.6 (8.0.6) on macOs Catalina for some reason -
I went to manage cookies → whitelist domain → added my domain
Cleared my cookies
Sent the same request, and ‘set-cookie’ requests are still captured
Is there a way to keep them clear after each request?
it is not possible to change cookies, well - how can I set/unset/clear cookies with httpOnly flag? Could you suggest any idea @danny-dainton?
The url is in Whitelist domains.
I have the same issue with the latest version of postman. I write a function clear cookies after test but it not work. This is my code
// clear cookies
async function clearCookies() {
const jar = pm.cookies.jar();
if (jar) jar.clear(pm.request.url, function (error) {
// error - <Error>
throw (error);
});
}