Postman $GUID: Remove hyphens and make all character uppercase

Viewed 5714

Can someone help me to remove the hyphens and transform all characters to uppercase (from a postman $guid)?

Haven't find anything useful.

Thanks

1 Answers

There are many hacky ways to do this in Postman, here's one of them:

let guid = pm.variables.replaceIn('{{$guid}}')

let formattedGuid = guid.replace(/-/g, '').toUpperCase()

pm.globals.set("newGuid", formattedGuid)

If you add that to the Pre-request Script, you'll be able to use it in the requests.

Related