Skip to content

Feature: Add pre-request and test scripts support #14

@AkashBhuiyan

Description

@AkashBhuiyan

Description

Allow users to write JavaScript scripts that run before a request (pre-request) and after receiving a response (tests), similar to Postman.

Requirements

  • Pre-request script editor
  • Test script editor
  • Built-in variables (request, response, environment)
  • Assertion library (expect, assert)
  • Console output panel
  • Script templates/snippets

Example Usage

// Pre-request script
const timestamp = Date.now();
pm.environment.set("timestamp", timestamp);

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

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

Labels

enhancement, feature, frontend, backend

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions