Skip to content

info

hc.info

Available since v2.0.0

ParameterTypeDescription
eventName"prerequest"` | `"test""prerequest"during pre-request scripts;"test"` during post-request scripts
requestNamestringDisplay name of the saved request
requestIdstringSaved request database id as a string; empty when the tab is unsaved
iterationnumberCollection run iteration index (0 for manual sends and non-data-driven runs)
workflowIdstringUUID of the workflow being played; empty when not in a workflow
workflowActionIdstringUUID of the workflow action currently executing; empty when not in a workflow
workflowActionIterationnumber0-based index of the workflow action currently executing; -1 when not in a workflow
livepageIdstringUUID of the linked live page; empty for HTTP requests and unsaved browser tabs
liveserverIdstringSaved 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;
  });
}