httplens

0.2.0 • Public • Published

HTTPWatch

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.

Installation

npm install -g httpwatch

# or

npx httpwatch

Usage

# Run with default port (3000)
httpwatch

# Run with custom port
httpwatch -p 8080

# Show help
httpwatch --help

Test Examples

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"}'

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i httplens

Weekly Downloads

0

Version

0.2.0

License

none

Unpacked Size

6.13 kB

Total Files

4

Last publish

Collaborators

  • anoopmd