← All features

Scripts

Scripts that travel

Pre-request scripts and response handlers use the JetBrains .http syntax, so they also run in Rider and IntelliJ. Postman's pm.* API works too, so imported collections run as they are.

Scripts are edited on the request's Scripts tab; client.log output appears in the Console.

Script files

When a workflow needs real logic

A .js file that calls send("name") runs the folder's requests by name, exactly as pressing Send would, with loops, branches and checks in between. Type send(" and the request names are suggested.

  • input() and confirm() ask as they go; poll() waits for jobs.
  • The output lists each log line and request in order; select one to see its response.
A release script: create a draft, then poll the build until it's done.

Sandboxed

The APIs you already know

Scripts run in a sandboxed JavaScript interpreter with no access to your files, and request scripts are stopped after 30 seconds.

  • JetBrains: client.global, request.variables, client.test, crypto hashes and HMACs, $random.
  • Postman: pm.test, pm.expect, pm.environment, pm.sendRequest and CryptoJS.
  • A file of pre-request code for every request in a file with # @reqjet.pre-request ./auth.js.
api/profile.http
### Get my profile
< {%
  request.variables.set("requestId", $random.uuid);
%}
GET {{baseUrl}}/me
X-Request-Id: {{requestId}}

> {%
  client.global.set("userId", response.body.id);
  client.test("Status is 200", () =>
    client.assert(response.status === 200));
%}
Reqjet logo

Try it on your own requests

Free for Windows, macOS and Linux, and it opens the .http files you already have.