Why does Postman allow clear cookie only after request?

When interacting with Postman, I needed to delete the Cookie BEFORE executing the request (pre request script), but it turned out that deleting cookies is only possible AFTER executing the request (tests). Please tell me why it is not possible to delete cookies before executing the request? Or maybe I’m doing something wrong. If necessary, the code used to delete cookies is attached below

const jar = pm.cookies.jar();
jar.clear(pm.request.url, function (error) {
});

Hi @science-specialist14. Welcome to the Postman Community!

Postman does not automatically include cookies in your sent requests. However, you can include cookies yourself using the request headers.

Pre-request scripts are only able to work with data it has access to before a request is sent and hence can not clear cookies if they technically do not exists.

When you get a response back from your request, Postman is able to identify the response cookies and provide a way for you to easily clear them in your post-response scripts.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.