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.

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.

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