# pm.sendRequest not working in post request Test

**URL:** <https://community.postman.com/t/pm-sendrequest-not-working-in-post-request-test/24868>\
**Category:** Help Hub\
**Created:** [June 14, 2021, 10:07pm UTC](https://community.postman.com/t/pm-sendrequest-not-working-in-post-request-test/24868 "2021-06-14T22:07:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dktest11](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dktest11](https://community.postman.com/u/dktest11)\
**Post date:** [June 14, 2021, 10:07pm UTC](https://community.postman.com/t/pm-sendrequest-not-working-in-post-request-test/24868/1 "2021-06-14T22:07:14Z")

</div>

I created a method in collection level prerequest script as follows :

```auto
utils = {

  testPMReq : function() {
       console.log("I am here");
        pm.sendRequest("https://postman-echo.com/get", function (err, response) {
        console.log(response.json());
    }); 
  }
};

```

and then used this method in a post request test as follows :

```auto
utils.testPMReq();

```

It prints out: “I am here” but it doesnt execute the pm.sendRequest call.

When I call utils.testPMReq(); in collection level pre-prequest script right after method creation, it executes the send request call.

Can someone please help why sendRequest is not working when I execute the method from post request script and how I can make it work?

---

<div class="post-metadata">

**Author:** ![nicostrecker](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@nicostrecker](https://community.postman.com/u/nicostrecker)\
**Post date:** [November 7, 2022, 7:14pm UTC](https://community.postman.com/t/pm-sendrequest-not-working-in-post-request-test/24868/2 "2022-11-07T19:14:31Z")

</div>

My issue was to send some headers that should not be sent with a get request. This happened by copying the post request headers for the get request.

I hope it helps somone 🙂 .
