how to encode uri in prereuqest script postman 1

how to encode uri in prereuqest script postman

var encoded = encodeURIComponent(pm.environment.get("phone number"));

Here is what the above code is Doing:
1. It’s getting the value of the variable “phone number” from the environment.
2. It’s encoding the value of the variable “phone number” using the encodeURIComponent() function.
3. It’s assigning the encoded value to a new variable called “encoded”.

Now, let’s use the “encoded” variable in the URL.

Similar Posts