# Why does Postman allow clear cookie only after request?

**URL:** <https://community.postman.com/t/why-does-postman-allow-clear-cookie-only-after-request/61603>\
**Category:** Help Hub\
**Tags:** tests, cookies, pre-request-script\
**Created:** [May 29, 2024, 10:02am UTC](https://community.postman.com/t/why-does-postman-allow-clear-cookie-only-after-request/61603 "2024-05-29T10:02:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![science-specialist14](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/science-specialist14/32/28783_2.png) [@science-specialist14](https://community.postman.com/u/science-specialist14)\
**Post date:** [May 29, 2024, 10:02am UTC](https://community.postman.com/t/why-does-postman-allow-clear-cookie-only-after-request/61603/1 "2024-05-29T10:02:44Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![gbadebo-bello](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbadebo-bello/32/12175_2.png) [@gbadebo-bello](https://community.postman.com/u/gbadebo-bello)\
**Post date:** [May 30, 2024, 10:06am UTC](https://community.postman.com/t/why-does-postman-allow-clear-cookie-only-after-request/61603/2 "2024-05-30T10:06:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [June 29, 2024, 10:07am UTC](https://community.postman.com/t/why-does-postman-allow-clear-cookie-only-after-request/61603/3 "2024-06-29T10:07:38Z")

</div>

Closed on June 29, 2024, 10:07am UTC

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