A simple CLI tool that listens on a specified port and provides detailed information about incoming HTTP requests, including headers, cookies, payload, and client IP.
npm install -g httpwatch
# or
npx httpwatch
# Run with default port (3000)
httpwatch
# Run with custom port
httpwatch -p 8080
# Show help
httpwatch --help
Here are some curl commands to test different types of requests:
# Basic GET Request
curl http://localhost:3000/test
# GET Request with Headers
curl http://localhost:3000/test \
-H "Custom-Header: TestValue" \
-H "Authorization: Bearer test-token"
# GET Request with Cookies
curl http://localhost:3000/test \
-H "Cookie: session=123; user=john"
# POST Request with JSON Payload
curl http://localhost:3000/api/data \
-X POST \
-H "Content-Type: application/json" \
-d '{"name": "John", "age": 30}'
# POST Request with Form Data
curl http://localhost:3000/submit \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=john&password=doe"
# PUT Request with JSON
curl http://localhost:3000/api/user/1 \
-X PUT \
-H "Content-Type: application/json" \
# DELETE Request
curl http://localhost:3000/api/user/1 -X DELETE
# Complex Request
curl http://localhost:3000/api/data \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer abc123" \
-H "Custom-Header: Value" \
-H "Cookie: session=xyz; theme=dark" \
-d '{"user": {"name": "John", "email": "john@example.com"}, "action": "update"}'