i just wanna know if there is a way to url encode an dynamic email variable in postman? basically i want random names in all parts of the email for my collection run. For example [email protected] , [email protected].(which can be solved by using the email variable provided by postman) However, i also need to url encode that email so it will look something like this
test1%40abc.com
please let me know if this can be achieved with JS code snippet or any other easier method, Thanks in advance. :)
Add this line to your request's preRequest script:
pm.environment.set("randomEncodedEmail", encodeURIComponent(pm.variables.replaceIn('{{$randomEmail}}')));
to generate an encoded random email address.
Then you can just use {{randomEncodedEmail}} in your request to use it.