Calculate hash of request body in Postman

Our web service expects the MD5 hash of the whole body. I think this could be done with the pre-request script. Does anybody know how I can access the request body in the pre-request script?

I found this for creating the md5: How to compute a md5 hash in a pre-request script in PostMan?

...but it doesn't show how to access the body.

dummy request


I found my solution:

I access the request data and stringify it, after this is push everything in an Array and gerneate with with join my string. After this is just need some MD5 methode and voilà, everything is working.

var rdata = request.data;
var requestLength = JSON.stringify(JSON.parse(rdata)).length;

var presharedkey = "XXXXKEYXXXXX";
var DeviceID = "3111110000666000";
var d = new Date();
var timestamp = d.getTime();

var AdditionalInfoString = [];
AdditionalInfoString.push(requestLength,DeviceID,presharedkey,timestamp);
AdditionalInfoString = AdditionalInfoString.join("");

var hash = CryptoJS.MD5(AdditionalInfoString);

postman.setGlobalVariable("AdditionalInfo", hash.toString());