A Rust CLI tool for local webhook testing with an interactive TUI interface. Listens on localhost:9080, logs all incoming HTTP requests, and displays them in real-time.
- HTTP Server: Catches all routes and HTTP methods
- Real-time TUI: Interactive terminal interface with request list and details
- Request Details: View method, path, headers, query params, body, and timestamps
- Configurable Responses: Return custom responses based on path/method
- JSON Pretty-Print: Automatically formats JSON bodies for readability
- Keyboard Navigation: Vim-style keybindings (j/k) and arrow keys
Build the project:
cargo build --releaseThe binary will be available at ./target/release/webhook
Run the webhook handler:
./target/release/webhookOr with cargo:
cargo runThe server will start listening on localhost:9080 and display an interactive TUI.
Create a config.yaml file in the project directory or at ~/.config/webhook/config.yaml:
# Server settings
port: 9080
host: "127.0.0.1"
# Default response for all requests
response:
status: 200
headers:
Content-Type: "application/json"
body: '{"status": "ok"}'
# Path-specific responses
routes:
- path: "/health"
method: "GET"
response:
status: 200
body: '{"healthy": true}'The interface is divided into three sections:
- Scrollable list of captured requests
- Shows timestamp, HTTP method, and path
- Newest requests at the top
- Selected request is highlighted
- Detailed view of selected request:
- Full timestamp
- HTTP method and complete URL
- Headers (sorted alphabetically)
- Body (with JSON pretty-printing)
- Current listening address
- Request count
- Keyboard shortcuts
qorEsc- Quit the applicationc- Clear all requests↑ork- Move selection up↓orj- Move selection downEnter- Expand/collapse body viewPage Up- Scroll detail pane upPage Down- Scroll detail pane down
Test the webhook handler with curl:
# POST request with JSON body
curl -X POST localhost:9080/webhook \
-H "Content-Type: application/json" \
-d '{"test": true, "message": "Hello"}'
# GET request
curl localhost:9080/health
# PUT request with data
curl -X PUT localhost:9080/api/data \
-H "Authorization: Bearer token123" \
-d "hello world"
# DELETE request
curl -X DELETE localhost:9080/api/resource/123All requests will appear in real-time in the TUI.
webhook/
├── Cargo.toml
├── config.yaml # Configuration file
├── README.md
└── src/
├── main.rs # Entry point, spawns server + TUI
├── server.rs # Axum HTTP server with catch-all handler
├── config.rs # Configuration loading/parsing
├── request.rs # Request model and formatting
└── ui/
├── mod.rs # TUI module entry point
├── app.rs # App state and event handling
└── render.rs # UI rendering logic
- HTTP Server: axum (async, ergonomic, tokio-based)
- TUI Framework: ratatui + crossterm
- Async Runtime: tokio
- Serialization: serde + serde_json + serde_yaml
- Date/Time: chrono
MIT