Skip to main content
The recording proxy captures HTTP requests and responses flowing through it, then exports them as .http files. It is a fast way to bootstrap tests from existing API traffic.

How It Works

  1. Start the proxy pointing at your target server
  2. Send requests through the proxy (manually or from your app)
  3. Stop the proxy (Ctrl+C)
  4. hitspec exports all captured traffic as a .http file

Quick Start

# Start recording proxy
hitspec record --port 8080 --target https://api.example.com

# In another terminal, send requests through the proxy
curl http://localhost:8080/users
curl -X POST http://localhost:8080/users -d '{"name":"John"}'

# Press Ctrl+C to stop and export

Flags

FlagShortDescriptionDefault
--port-pPort to run the proxy on8080
--target-tTarget URL to proxy to (required)
--output-oOutput file path (default: stdout)
--excludePaths to exclude (comma-separated)
--verbose-vEnable verbose loggingfalse
--dedupeSkip duplicate requests (same method+path)false
--jsonExport as JSON instead of .http formatfalse

Examples

hitspec record --target https://api.example.com -o recorded.http

What Gets Recorded

The proxy captures:
  • HTTP method and URL
  • Request headers
  • Request body
  • Response status code

What Gets Sanitized

The proxy automatically sanitizes sensitive headers in the output:
  • Authorization headers are replaced with placeholders
  • Cookie headers are replaced with placeholders
  • Other sensitive headers are cleaned

Output Format

The exported .http file follows standard hitspec format:
### GET /users
# @name get_users

GET https://api.example.com/users
Accept: application/json

>>>
expect status == 200
<<<

### POST /users
# @name post_users

POST https://api.example.com/users
Content-Type: application/json

{
  "name": "John"
}

>>>
expect status == 200
<<<
After recording, edit the generated file to add meaningful assertions, replace hardcoded values with variables, and add @depends directives for request ordering.