I am testing my API in Postman and am having trouble simulating a log out.
If I do a call to delete the session cookie,
new version of postman app has the ability to do that programmatically in pre-request or tests scripts since 2019/08
see more examples here: Delete cookies programmatically · Issue #3312 · postmanlabs/postman-app-support
const jar = pm.cookies.jar();
jar.clear(pm.request.url, function (error) {
// error -
});
const jar = pm.cookies.jar();
jar.getAll('http://example.com', function (error, cookies) {
// error -
// cookies -
// PostmanCookieList: https://www.postmanlabs.com/postman-collection/CookieList.html
});
const jar = pm.cookies.jar();
jar.get('http://example.com', 'token', function (error, value) {
// error -
// value -
});