aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md72
1 files changed, 72 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..db49664
--- /dev/null
+++ b/README.md
@@ -0,0 +1,72 @@
+# httpdump
+
+Parse HTTP requests and responses into JSON.
+
+## Installation
+
+```bash
+uv sync
+```
+
+## Usage
+
+```bash
+# Parse HTTP request from stdin
+nc -lp 8080 | uv run httpdump
+
+# Parse HTTP response
+curl -si https://example.com | uv run httpdump --response
+
+# Parse from file
+uv run httpdump request.txt
+uv run httpdump --response response.txt
+```
+
+## Output Format
+
+### Request
+```json
+{
+ "method": "POST",
+ "url": "/api/users?page=1",
+ "path": "/api/users",
+ "query_params": {"page": "1"},
+ "headers": {
+ "raw_base64": "...",
+ "parsed": {"Content-Type": "application/json", "Host": "example.com"}
+ },
+ "body": {
+ "raw_base64": "...",
+ "json": {"name": "John"}
+ }
+}
+```
+
+### Response
+```json
+{
+ "status_code": 200,
+ "status_text": "OK",
+ "headers": {
+ "raw_base64": "...",
+ "parsed": {"Content-Type": "application/json"}
+ },
+ "body": {
+ "raw_base64": "...",
+ "json": {"id": 1}
+ }
+}
+```
+
+## Body Parsing
+
+Body is parsed based on Content-Type:
+- `application/json` → `body.json`
+- `application/x-www-form-urlencoded` → `body.form`
+- `multipart/form-data` → `body.multipart`
+
+Raw body is always available as base64 in `body.raw_base64`.
+
+## Options
+
+- `-r, --response` - Parse as HTTP response instead of request