Skip to main content
The rq.info object provides metadata about the current script execution context. It contains information about the request being executed, the current iteration (when running collections), and the event type.

Methods

rq.info.requestId

Type: string The unique identifier of the request being executed. Example:
console.log("Request ID:", rq.info.requestId);
// Output: Request ID: abc123xyz

rq.info.requestName

Type: string The name of the request being executed. Example:
console.log("Request Name:", rq.info.requestName);

rq.info.eventName

Type: "prerequest" | "postresponse" The type of script event currently executing. Returns "prerequest" for pre-request scripts and "postresponse" for post-response scripts. Example:
if (rq.info.eventName === "prerequest") {
    console.log("Running pre-request script");
} else {
    console.log("Running post-response script");
}

rq.info.iteration

Type: number The current iteration index when running a collection with the Collection Runner. The index is 0-based, meaning the first iteration is 0, the second is 1, and so on. For single request executions (not part of a collection run), this value is 0. Example:
console.log("Current iteration:", rq.info.iteration);
// Output: Current iteration: 0 (first iteration)
// Output: Current iteration: 2 (third iteration)

rq.info.iterationCount

Type: number The total number of iterations configured for the collection run. For single request executions, this value is 1. Example:
console.log(`Running iteration ${rq.info.iteration + 1} of ${rq.info.iterationCount}`);
// Output: Running iteration 3 of 10