# Re-send the same request not working

**URL:** <https://community.postman.com/t/re-send-the-same-request-not-working/69829>\
**Category:** Help Hub\
**Tags:** collections, scripts, setnextrequest, request\
**Created:** [October 17, 2024, 3:45am UTC](https://community.postman.com/t/re-send-the-same-request-not-working/69829 "2024-10-17T03:45:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![koustubh24](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@koustubh24](https://community.postman.com/u/koustubh24)\
**Post date:** [October 17, 2024, 3:45am UTC](https://community.postman.com/t/re-send-the-same-request-not-working/69829/1 "2024-10-17T03:45:19Z")

</div>

Hello experts !, I’m trying to mimic a scenario where the end-user accidentally clicks the button twice & request is sent twice !!

**try to achieve** : sending the same request again after checking the response code.

**problem/issue** : the console.log within the “if block” gets printed but it seems that the same request is NOT send …

**my (simple) logic example in Post-response**:

```auto
if(pm.response.code == '404') {
    console.log('resending !!');
    pm.execution.setNextRequest(pm.info.requestName);
    console.log('sent')
}

```

so basically, the console logs are just printed but it seems the Postman is NOT setting the next request to itself …

can someone please rectify my logic here?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 17, 2024, 5:28am UTC](https://community.postman.com/t/re-send-the-same-request-not-working/69829/2 "2024-10-17T05:28:20Z")

</div>

Hey @koustubh24 👋🏻

Are you using the Collection Runner to do that as that `setNextRequest` function would only work with that.

This wouldn’t work for an [individual request](https://learning.postman.com/docs/collections/running-collections/building-workflows/#use-setnextrequest-when-you-run-an-entire-collection).

> Use the `pm.execution.setNextRequest()` function when running a collection with the Collection Runner, the Postman CLI, or Newman. It has no effect when you run a request using **Send**.

---

<div class="post-metadata">

**Author:** ![koustubh24](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@koustubh24](https://community.postman.com/u/koustubh24)\
**Post date:** [October 18, 2024, 3:19am UTC](https://community.postman.com/t/re-send-the-same-request-not-working/69829/3 "2024-10-18T03:19:44Z")

</div>

@danny-dainton , thank you for that insight as I had no idea 😀. I intend to use it in “Collection Runner” but for testing the logic I was doing in the “individual request”. Will keep that in mind, thank you again !

---

<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:** [October 21, 2024, 3:19am UTC](https://community.postman.com/t/re-send-the-same-request-not-working/69829/4 "2024-10-21T03:19:49Z")

</div>

Closed on October 21, 2024, 3:19am UTC

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