lacspace-http

Terminal API client + .http runner with assertions.

terminal
npx lacspace-http https://httpbin.org/get
What it does

Everything, in one command

lacspace-http does two jobs from one binary. Ad-hoc, it sends an HTTP request and pretty-prints the JSON with status, timing and size — with bearer/basic auth, query params, JSON/form bodies, redirect and size caps, and a --curl printer that masks secrets. As a runner, it parses the well-known .http format (the VS Code REST Client / JetBrains one), resolves {{variables}} from env files and captured values, chains a token from one response into the next, and checks @assert conditions on status, JSON body, headers and timing. Everything is built on the global fetch and Node built-ins — no dependencies, no account, no telemetry.

Features

What's inside

Ad-hoc requests

GET/POST/… with headers, query, JSON (-j k=v, k:=raw), forms, bearer & basic auth.

.http / .rest runner

Run a whole file of named requests in order, or one via --name.

Capture & chaining

# @capture token = body.$.access_token, reused as {{token}} downstream.

Assertions = CI tests

Assert on status, JSON-path body, headers, time; a failure exits non-zero.

Variables & env files

{{var}} from http-client.env.json / .env / --var, plus system vars.

Nice output

Coloured status, pretty JSON, timing/size; --json machine record; NO_COLOR and pipe-safe.

--curl printer

Copy-pasteable curl with credentials masked by default.

Retry with backoff

--retry N recovers flaky endpoints (network errors + 408/429/5xx) with exponential backoff + jitter.

Latency benchmark

--repeat N fires a request N times and reports min/mean/median/p95/p99/max.

HAR 1.2 export

--har out.har writes a standard log you can open in Chrome DevTools, Insomnia or Postman.

# @expect assertions

A friendlier alias for # @assert, with json.<path> shorthand for JSON-body checks.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Quick GET
terminal
npx lacspace-http https://httpbin.org/get

Pretty-prints JSON with status, timing and size.

POST JSON
terminal
npx lacspace-http POST https://httpbin.org/post -j name=Ada -j admin:=true

-j is a string field; k:=v is a raw JSON value.

Auth + curl
terminal
npx lacspace-http https://api.example.com/me -b "$TOKEN" --curl

Prints the equivalent curl; the token is masked.

Run a .http suite
terminal
npx lacspace-http run api.http --env dev

Captures a login token, chains it, asserts responses.

CI smoke test
terminal
npx lacspace-http run smoke.http --var host=http://localhost:3000

Exit code is non-zero if any assertion fails.

Retry a flaky endpoint
terminal
lacspace-http https://api.example.com/flaky --retry 3 --retry-delay 500

Exponential backoff + jitter on network errors and 5xx.

Benchmark latency
terminal
lacspace-http https://httpbin.org/get --repeat 50

Prints min/mean/median/p95/p99/max; add --json for scripts.

Export a HAR log
terminal
lacspace-http run api.http --har run.har

Open the run in Chrome DevTools or any HAR viewer.

Good for

What people build with it

✓ Poke an API quickly without opening Postman

✓ Smoke/contract tests in CI from a versioned .http file

✓ Auth flows that need a captured token

✓ Share a runnable request collection in the repo

Start now

Run lacspace-http today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-http https://httpbin.org/get