@@ -34,17 +34,69 @@ docker run -p 8080:8080 -v $(pwd)/.env:/app/.env ghcr.io/jsr-probitas/echo-http:
3434
3535## API
3636
37- | Endpoint | Method | Description |
38- | ------------------ | ------ | ----------------------------------------- |
39- | ` /get ` | GET | Echo request info (query params, headers) |
40- | ` /post ` | POST | Echo request body (JSON, form data) |
41- | ` /put ` | PUT | Echo request body |
42- | ` /patch ` | PATCH | Echo request body |
43- | ` /delete ` | DELETE | Echo request info |
44- | ` /headers ` | GET | Echo headers only |
45- | ` /status/{code} ` | GET | Return specified status code (100-599) |
46- | ` /delay/{seconds} ` | GET | Echo after delay |
47- | ` /health ` | GET | Health check |
37+ ### Echo Endpoints
38+
39+ | Endpoint | Method | Description |
40+ | ------------ | ------ | ----------------------------------------- |
41+ | ` /get ` | GET | Echo request info (query params, headers) |
42+ | ` /post ` | POST | Echo request body (JSON, form data) |
43+ | ` /put ` | PUT | Echo request body |
44+ | ` /patch ` | PATCH | Echo request body |
45+ | ` /delete ` | DELETE | Echo request info |
46+ | ` /anything ` | ANY | Echo any request (method, headers, body) |
47+ | ` /anything/* ` | ANY | Echo any request with path |
48+
49+ ### Utility Endpoints
50+
51+ | Endpoint | Method | Description |
52+ | ------------------ | ------ | -------------------------------------- |
53+ | ` /headers ` | GET | Echo headers only |
54+ | ` /ip ` | GET | Return client IP address |
55+ | ` /user-agent ` | GET | Return User-Agent header |
56+ | ` /status/{code} ` | ANY | Return specified status code (100-599) |
57+ | ` /delay/{seconds} ` | GET | Echo after delay (max 30s) |
58+ | ` /health ` | GET | Health check |
59+
60+ ### Redirect Endpoints
61+
62+ | Endpoint | Method | Description |
63+ | ---------------------- | ------ | ------------------------------------- |
64+ | ` /redirect/{n} ` | GET | Redirect n times before final response|
65+ | ` /redirect-to ` | GET | Redirect to URL (?url=...&status_code=)|
66+ | ` /absolute-redirect/{n} ` | GET | Redirect n times with absolute URLs |
67+ | ` /relative-redirect/{n} ` | GET | Redirect n times with relative URLs |
68+
69+ ### Authentication Endpoints
70+
71+ | Endpoint | Method | Description |
72+ | ---------------------------- | ------ | ---------------------------------------- |
73+ | ` /basic-auth/{user}/{pass} ` | GET | Basic auth (200 if match, 401 otherwise) |
74+ | ` /hidden-basic-auth/{user}/{pass} ` | GET | Basic auth (200 if match, 404 otherwise)|
75+ | ` /bearer ` | GET | Bearer token validation |
76+
77+ ### Cookie Endpoints
78+
79+ | Endpoint | Method | Description |
80+ | ----------------- | ------ | ---------------------------------------- |
81+ | ` /cookies ` | GET | Echo request cookies |
82+ | ` /cookies/set ` | GET | Set cookies (?name=value) and redirect |
83+ | ` /cookies/delete ` | GET | Delete cookies (?name) and redirect |
84+
85+ ### Binary Data Endpoints
86+
87+ | Endpoint | Method | Description |
88+ | -------------- | ------ | -------------------------------- |
89+ | ` /bytes/{n} ` | GET | Return n random bytes (max 100KB)|
90+ | ` /stream/{n} ` | GET | Stream n JSON lines (max 100) |
91+ | ` /drip ` | GET | Drip data (?duration=&numbytes=&delay=)|
92+
93+ ### Compression Endpoints
94+
95+ | Endpoint | Method | Description |
96+ | ----------- | ------ | ----------------------------- |
97+ | ` /gzip ` | GET | Return gzip-compressed response |
98+ | ` /deflate ` | GET | Return deflate-compressed response |
99+ | ` /brotli ` | GET | Return brotli-compressed response |
48100
49101See [ docs/api.md] ( ./docs/api.md ) for detailed API reference.
50102
@@ -78,6 +130,32 @@ curl http://localhost:8080/status/418
78130
79131# Delayed response (for timeout testing)
80132curl http://localhost:8080/delay/5
133+
134+ # Redirect testing
135+ curl -L http://localhost:8080/redirect/3
136+
137+ # Basic authentication
138+ curl -u user:pass http://localhost:8080/basic-auth/user/pass
139+
140+ # Bearer token
141+ curl -H " Authorization: Bearer my-token" http://localhost:8080/bearer
142+
143+ # Cookie handling
144+ curl -c cookies.txt http://localhost:8080/cookies/set? session=abc123
145+ curl -b cookies.txt http://localhost:8080/cookies
146+
147+ # Get client IP
148+ curl http://localhost:8080/ip
149+
150+ # Compression testing
151+ curl --compressed http://localhost:8080/gzip
152+ curl --compressed http://localhost:8080/brotli
153+
154+ # Stream data
155+ curl http://localhost:8080/stream/5
156+
157+ # Random bytes
158+ curl http://localhost:8080/bytes/100 --output random.bin
81159```
82160
83161## Development
0 commit comments