Skip to content
aarushvanPublic

About

HTTP record and replay proxy with YAML cassettes, schema diffs, and a local waterfall inspector.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

tapeline

CI

Tapeline records HTTP exchanges through a local reverse proxy and replays them from a YAML cassette. Inspect the request waterfall in a terminal or browser, or compare two recordings for status, JSON schema, and latency changes.

Quickstart

Build with Go 1.27.4 or later from the repository root.

CGO_ENABLED=0 go build -ldflags="-s -w" -o tapeline .
./tapeline --help

Start a test upstream in another terminal. This example requires Python 3.

upstream_dir=$(mktemp -d)
printf '{"ok":true}\n' > "$upstream_dir/status.json"
python3 -m http.server 3000 --bind 127.0.0.1 --directory "$upstream_dir"

Start the recorder in the checkout.

./tapeline record --target http://127.0.0.1:3000 --port 8080 --out api.yaml

Send a request from a separate terminal.

curl http://127.0.0.1:8080/status.json

Press Ctrl+C in the recorder terminal to write the cassette. Stop the test upstream to check offline replay. Request the same URL again while replay is running.

./tapeline inspect api.yaml
./tapeline replay --cassette api.yaml --port 8080

Run ./tapeline ui api.yaml --port 8788 and open 127.0.0.1:8788 for the waterfall and formatted request and response bodies. Pass --compare next.yaml to compare recordings.

Architecture

  • proxy.go forwards requests and streams responses as they arrive. It buffers bodies for each complete exchange, including binary bodies.
  • cassette.go reads and writes YAML with sorted header keys. By default it redacts Authorization, Cookie, Set-Cookie, and X-Api-Key headers case-insensitively. --no-redact keeps those values. Request and response bodies are stored verbatim.
  • replay.go indexes exchanges by method, escaped path, and query. Replay treats different parameter names as unordered and preserves the value order for repeated names. A route with multiple recordings cycles through its responses in recording order. Matches set X-Tapeline-Replay: hit. Misses return 404 JSON and X-Tapeline-Replay: miss.
  • The CLI inspector and embedded web UI read the same cassette format. Both comparison surfaces use the status, schema, and latency diff in diff.go.

Use ./tapeline diff api.yaml next.yaml --json for machine-readable output. Add --fail-on-drift to fail on breaking status or schema changes.

Tests and benchmark

go test -race ./...
go test -run '^$' -bench '^BenchmarkReplay$' -benchmem

On an Apple M5 with Go 1.27.4 (darwin/arm64), matching a recorded route and writing its 1,024-byte body took 523.0 ns/op, 2,080 B/op, and 16 allocs/op over 2,250,187 iterations. The benchmark calls the replay handler with an in-memory HTTP recorder and includes query normalization.

Releases and license

Download binaries and checksums for macOS arm64 and Linux x86_64 or arm64 from the releases page. Licensed under MIT or Apache-2.0.

About

HTTP record and replay proxy with YAML cassettes, schema diffs, and a local waterfall inspector.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages