/pardon

another HTTP request framework

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Pardon

A batteries-included and very polite REST client that does what you want.

Collections are file-based, self-documenting, and securely sharable by default.

The AI (Adam's Incorrigibility) powered scriptable template matching and rendering system converts request template pseudocode into actual http requests, and the same framework power running your gamuts of functional testcases.

Quick start

This is primarily a source distribution in pure node module code, developed in Node20 with support for older node versions in some modes (for... reasons).

For running from source (this rep), the fastest path to get the application running is,

  • git clone https://github.com/adobe/pardon.git and cd pardon
  • npm install
  • npm install --prefix=packages/core
  • npm install --prefix=packages/favor
  • npm run package --prefix=packages/favor
  • find the application in packages/favor/out/....

To use pardon globally as a script, in the packages/core directory either run

  • npm link . (note the dot), or
  • npm install . --global

To remove the installation of pardon, use npm uninstall -g pardon (this works for both the link and install --global flavors).

Quickstart

Pardon comes with a default/default endpoint that allows any request through.

Collections can specify specific endpoints that pardon will call.

Collections are organized in folders (services), the special default service being checked if a request doesn't match any other endpoint. Similarly, the special default endpoint of a service is the fallback for unmatched requests that otherwise match the service rules (usually based on the server origin).

Workspaces

To enable pardon to save a history of requests and responses, and to specify collection folders, have a pardonrc.yaml file or add a "pardon": { ... } section to a package.json. This will mark the workspace root. Pardon will create a pardon.db file there.

When specifying a workspace folder, pardon will search up until it finds a workspace root, falling back to a home-directory ~/.pardon/pardonrc.yaml or ~/.config/pardon/pardonrc.yaml.

The schema for the pardonrc.yaml/package.json field is the same.

Collections can be specified by relative paths, e.g.,

collections:
  - ./collection/

Now create the following files:

./collection/example/ping.https with the contents

>>>
GET https://example.com/ping

./collection/example/service.yaml with the contents

config:
  origin:
    env:
      stage: https://stage.example.com
      prod: https://example.com

To get a sense of how configuration applies, try running

  • pardon https://example.com/ping --http,
  • pardon https://example.com/ping --http env=stage
  • pardon https://stage.example.com --http
  • pardon https://stage.example.com --http env=prod

Now change things to something useful to you and try running without the --http to actually run a request.

You can also build favor, set the context appropriately (menu), and enter the same as, e.g.,

env=stage
https://example.com/ping

in the main input.

Goals

Pardon is reaching for various goals.

  1. Toil and noise reduction.
  2. Secure-by-default flows for developers.
  3. Transparent parameterization.
  4. Useful and searchable logging.
  5. Scripting throughout.
  6. Integration testing and operational support.

Thanks!

Thank you to all our internal early adopters, the entire javascript ecosystem, and (in no particular order)