Pre-processor scripts are code snippets executed before a request is sent to the server. They are ideal for dynamic setup tasks, such as generating timestamps, calculating signatures, or setting random data.Example: Adding a Timestamp#
You can generate a timestamp and store it in an environment variable to use in your request headers.1.
Add Script: In the Pre Processors tab, add a Custom Script. 2.
Use Variable: In the Headers tab, reference the variable using {{timestamp}}. When the request sends, {{timestamp}} will be replaced with the calculated value.Pre-processors function similarly to post-request scripts but do not have access to the pm.response object since the response has not yet been received.