# How to dynamically change the request Method?

**URL:** <https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336>\
**Category:** Help Hub\
**Created:** [March 12, 2020, 11:00pm UTC](https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336 "2020-03-12T23:00:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrAutomationGuy](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MrAutomationGuy](https://community.postman.com/u/MrAutomationGuy)\
**Post date:** [March 12, 2020, 11:00pm UTC](https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336/1 "2020-03-12T23:00:01Z")

</div>

I have a scenario where I have to change the request method from POST to a GET, based on a given condition. How do I do that?

Scenario:

1. Request method originally is a POST

2. Read the condition1 from environment

3. If condition1 === true then pm.request.method.update(“GET”)  
something like this.

4. I only want to change the method, nothing else.

5. similar to how you add header dynamically using pm.request.methods.add method.

6. I don’t want to use a getRequest method I only want to update the method from POST to GET.

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [March 13, 2020, 8:13am UTC](https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336/2 "2020-03-13T08:13:28Z")

</div>

Hi @MrAutomationGuy, did you know about the fact that Postman let’s you define custom methods also?

And you can use that to your advantage by making the request method itself a variable.

You can type in the method as `{{METHOD}}` or anything else as you’d like.  
Then in your pre-request script, you can check your conditions as you’d like and make use of `local` variable or any other variable scope as you wish to and change the request method accordingly.

Something like so:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/e/e897df86cbb4d3858c9c95a4e8ff150ac2759e2e.png)

---

<div class="post-metadata">

**Author:** ![MrAutomationGuy](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MrAutomationGuy](https://community.postman.com/u/MrAutomationGuy)\
**Post date:** [March 13, 2020, 4:11pm UTC](https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336/3 "2020-03-13T16:11:48Z")

</div>

omg, thank you @singhsivcan. Yes yes, that resolved my issue. Where is this documented? that’s why you are a leader 🙂 Thank you Sir.

Thanks to you I found the link too: [Custom HTTP Methods == More Flexibility and Autonomy | Postman Blog](https://blog.postman.com/2018/11/14/custom-http-methods-more-flexibility-and-autonomy/)

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [March 13, 2020, 4:24pm UTC](https://community.postman.com/t/how-to-dynamically-change-the-request-method/11336/4 "2020-03-13T16:24:47Z")

</div>

Glad that it helped you out! 😃

Docs: [https://learning.postman.com/docs/postman/customizing-postman/](https://learning.postman.com/docs/postman/customizing-postman/)  
The original GitHub ticket: [Custom HTTP Methods · Issue #166 · postmanlabs/postman-app-support · GitHub](https://github.com/postmanlabs/postman-app-support/issues/166)
