Ripple
All guides

Script runtime (pm.*)

Postman-compatible pre-request and test scripts with async/await — pm.sendRequest(), cookies, crypto utilities, and assertions in the desktop app and rip CLI.

Jump to section

Overview

Scripts in Ripple run with access to a pm object that provides Postman-compatible APIs. The desktop uses a browser JavaScript environment with async/await. The rip CLI uses an embedded Boa sandbox with synchronous pm.sendRequest.

Scripts execute in-session on manual tab sends. Persistence to saved requests is improving — Collection Runner does not run tab scripts yet; use rip declarative assertions or rip with imported Postman scripts for CI.

Script types

  • Pre-request scripts — run before sending; modify URL, headers, body
  • Test scripts — run after response; assertions and data extraction
  • Stream scripts — WebSocket/SSE onMessage handlers

Basic pm object

pm.request.url        // Get/set request URL
pm.request.method     // Get/set request method
pm.request.headers    // Manage request headers
pm.request.body       // Get/set request body

pm.response.code      // HTTP status (test scripts only)
pm.response.json()    // Parse response as JSON
pm.response.text()    // Get response as text

pm.variables          // Environment variables
pm.globals            // Global variables
pm.collectionVariables // Collection variables

pm.sendRequest()

Send HTTP requests from within scripts. Desktop: fully async with await. CLI: synchronous blocking only — no callback-style async.

const response = await pm.sendRequest({
  url: "https://api.example.com/token",
  method: "POST",
  header: { "Content-Type": "application/json" },
  body: { mode: "raw", raw: '{"grant_type":"client_credentials"}' }
});
const json = response.json();
pm.environment.set("accessToken", json.access_token);

pm.cookies

  • pm.cookies.get(name), pm.cookies.set(name, value, options), pm.cookies.clear()
  • Domain and path support
  • In rip: in-memory jar; SQLite-backed when collection has DB id

pm.utils

  • Base64 encode/decode
  • SHA1, SHA256, MD5 hashing
  • UUID generation
  • Random string helpers

pm.test() & pm.expect()

Test scripts use pm.test for named assertions and pm.expect for chain-style checks:

pm.test("Status is 200", function () {
  pm.response.to.have.status(200);
});

pm.test("Body has id", function () {
  const json = pm.response.json();
  pm.expect(json.id).to.exist;
});

Scripts in rip CLI

  • Postman event scripts import on rip run postman and run via Boa pm.* sandbox
  • Supported: pm.environment/globals/collectionVariables, pm.request, pm.test, pm.response, pm.sendRequest (sync), pm.cookies, pm.utils, console.log
  • Common Postman test patterns auto-convert to declarative tests JSON on import
  • Use --verbose to see console.log output from scripts

Examples

Pre-request: sign request

  • Set timestamp header, compute HMAC with pm.utils, attach Authorization header

Test: extract token

  • Parse JSON body, pm.environment.set('token', json.access_token)

Chain setup via sendRequest

  • Pre-request script logs in via pm.sendRequest, stores session cookie for main request