Access expanded request.url and .body in pre-request script

In my pre-request script I want to access the full request.url and request.body (backstory is a hash algorithm will be run over those). I am also using environment variables in my request builder. In my pre-request script when I access request.url, it still has the environment variable name rather than the expanded value (Ex: http://{{server}}/endpoint). Is there a way to get the expanded value (Ex: http://dev-api.server/endpoint )? In the test script, I can access the request.url and I do get the expanded value. Also in the pre-request script the request.body is returned as undefined. Same thing, I would like to read the body that is going to be sent so I can pass it into the hash algorithm. Thanks.

Responding to my own as I was able to figure it out. Need to call the .substitute method on the collection of variables that are relevant. I know mine are in environment, not sure what the optimization would be if they are in either environment, collection or globals, but this seems to work:

pm.environment.values.substitute(pm.request.url, null, false);

Documentation at