I need to change URL of the API in the Postman script before the request is submitted. I see that URL variable is exposed but it's readonly. Is there anyway to accomplish what I need to do?
You can use this function within the pre-request script to change the URL before sending the request.
pm.request.url.update({protocol: "https", host: "jsonplaceholder.typicode.com/posts"})
The main request is set to hit the postman-echo service but the script changes this and sends it to the jsonplaceholder site.

More information about the types of options you can have in the update function, can be found here:
http://www.postmanlabs.com/postman-collection/Url.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With