info
hc.info
Available since v2.0.0
| Parameter | Type | Description |
|---|---|---|
eventName | "prerequest"` | `"test" | "prerequest"during pre-request scripts;"test"` during post-request scripts |
requestName | string | Display name of the saved request |
requestId | string | Saved request database id as a string; empty when the tab is unsaved |
iteration | number | Collection run iteration index (0 for manual sends and non-data-driven runs) |
workflowId | string | UUID of the workflow being played; empty when not in a workflow |
workflowActionId | string | UUID of the workflow action currently executing; empty when not in a workflow |
workflowActionIteration | number | 0-based index of the workflow action currently executing; -1 when not in a workflow |
livepageId | string | UUID of the linked live page; empty for HTTP requests and unsaved browser tabs |
liveserverId | string | Saved live server database id as a string; empty outside a live-server script run |
Postman-compatible metadata about the current script run, plus HarborClient workflow and live-page fields. Available in pre- and post-request scripts (including live page PreRequest / PostRequest scripts).
javascript
console.log(hc.info.eventName, hc.info.requestName, hc.info.requestId);
if (hc.info.workflowId) {
console.log(
"workflow action",
hc.info.workflowActionId,
hc.info.workflowActionIteration
);
}
if (hc.info.livepageId) {
console.log("live page", hc.info.livepageId);
}
if (hc.info.liveserverId) {
console.log("live server", hc.info.liveserverId);
}
if (hc.info.eventName === "test") {
hc.test("ran for " + hc.info.requestName, function () {
hc.expect(hc.info.requestId).to.be.ok;
});
}