Assume that I need to POST a raw json body containing a random {{$guid}}
and the current {{$isoTimestamp}}
.
Assume also that I need to hash that very same body using e.g. CryptoJS.MD5()
as part of a larger HMAC authentication scheme where the remote API will also perform the same MD5 hash and compare it to the hash of the incoming request.
Given that I can use pm.variables.replaceIn(pm.request.body)
to “resolve” both the {{$guid}}
and the {{$isoTimestamp}}
in the pre-request script, and use the result to generate the MD5 hash, how can I ensure that the exact same {{$guid}}
and {{$isoTimestamp}}
that are used in the pre-request script are also used in the actual request?
Right now, it seems Postman (v8) just generates another {{$guid}}
and {{$isoTimestamp}}
, which of course makes the authentication fail due to different MD5 hashes.