🚁 HTTPilot

A copilot tool to help understand HTTP requests and responses. Inspired by httpbin.

📋 API Endpoints

HTTP Methods Testing

GET /get
Test GET requests and view request information
GET:curl "http://localhost:5000/get?param1=value1¶m2=value2"
POST /post
Test POST requests with form data or JSON
POST:curl -X POST "http://localhost:5000/post" -H "Content-Type: application/json" -d '{"key":"value","number":42}'
PUT /put
Test PUT requests with data
PUT:curl -X PUT "http://localhost:5000/put" -H "Content-Type: application/json" -d '{"update":"data"}'
DELETE /delete
Test DELETE requests
DELETE:curl -X DELETE "http://localhost:5000/delete"
PATCH /patch
Test PATCH requests with partial data
PATCH:curl -X PATCH "http://localhost:5000/patch" -H "Content-Type: application/json" -d '{"field":"updated_value"}'
HEAD /head
Test HEAD requests (headers only)
HEAD:curl -I "http://localhost:5000/head"
OPTIONS /options
Test OPTIONS requests
OPTIONS:curl -X OPTIONS "http://localhost:5000/options"

Status Codes

GET POST PUT PATCH OPTIONS /status/<code>
Return response with specific HTTP status code (e.g., /status/404). Supports multiple HTTP methods.
GET:curl -L "http://localhost:5000/status/301"
POST:curl -X POST "http://localhost:5000/status/404"
PUT:curl -X PUT "http://localhost:5000/status/200"
PATCH:curl -X PATCH "http://localhost:5000/status/500"
OPTIONS:curl -X OPTIONS "http://localhost:5000/status/204"
GET /status/random
Return response with random status code. Only supports GET method.
GET:curl "http://localhost:5000/status/random"

Request Inspection

GET /headers
Return request headers information
GET:curl -H "Custom-Header: test-value" "http://localhost:5000/headers"
GET /ip
Return client IP address
GET:curl "http://localhost:5000/ip"
GET /user-agent
Return user agent and browser information
GET:curl -A "Custom-Agent/1.0" "http://localhost:5000/user-agent"

Response Inspection

GET POST /response-headers
Set custom response headers via query parameters
GET:curl "http://localhost:5000/response-headers?X-Custom=test&Server=HTTPilot"
POST:curl -X POST "http://localhost:5000/response-headers?Cache-Control=no-cache"

Response Formats & Encoding

GET /json
Return sample JSON data with various data types
GET:curl "http://localhost:5000/json"
Pretty:curl -s "http://localhost:5000/json" | python -m json.tool
GET /xml
Return sample XML data with proper XML structure
GET:curl "http://localhost:5000/xml"
Headers:curl -i "http://localhost:5000/xml"
GET /html
Return sample HTML data with proper HTML structure
GET:curl "http://localhost:5000/html"
Headers:curl -i "http://localhost:5000/html"
GET /robots.txt
Return robots.txt file with crawling rules
GET:curl "http://localhost:5000/robots.txt"
GET /brotli
Return Brotli-compressed response data (requires Accept-Encoding: br)
GET:curl -H "Accept-Encoding: br" "http://localhost:5000/brotli"
Decompressed:curl --compressed -H "Accept-Encoding: br" "http://localhost:5000/brotli"
GET /deflate
Return Deflate-compressed response data (requires Accept-Encoding: deflate)
GET:curl -H "Accept-Encoding: deflate" "http://localhost:5000/deflate"
Decompressed:curl --compressed -H "Accept-Encoding: deflate" "http://localhost:5000/deflate"
GET /gzip
Return GZip-compressed response data (requires Accept-Encoding: gzip)
GET:curl -H "Accept-Encoding: gzip" "http://localhost:5000/gzip"
Decompressed:curl --compressed -H "Accept-Encoding: gzip" "http://localhost:5000/gzip"
GET /encoding/utf8
Return UTF-8 encoded content with international characters
GET:curl "http://localhost:5000/encoding/utf8"

Cache

GET /cache
Test HTTP caching. Returns 304 (Not Modified) if If-Modified-Since or If-None-Match headers are present, otherwise returns data with Last-Modified and ETag headers.
GET:curl -i "http://localhost:5000/cache"
Conditional:curl -i -H "If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT" "http://localhost:5000/cache"
ETag:curl -i -H "If-None-Match: some-etag" "http://localhost:5000/cache"
GET /cache/<seconds>
Set Cache-Control header for specified number of seconds (e.g., /cache/300 for 5 minutes).
GET:curl -i "http://localhost:5000/cache/300"
1 hour:curl -i "http://localhost:5000/cache/3600"
GET /etag/<etag>
Test ETag handling. Returns 304 if If-None-Match matches, 412 if If-Match doesn't match (and not wildcard), otherwise returns normal response with the specified ETag.
GET:curl "http://localhost:5000/etag/test123"
Match:curl -i -H "If-None-Match: test123" "http://localhost:5000/etag/test123"
Wildcard:curl -i -H "If-None-Match: *" "http://localhost:5000/etag/test123"
If-Match:curl -i -H "If-Match: other-etag" "http://localhost:5000/etag/test123"

Dynamic Data

GET /delay/<seconds>
Return delayed response with timing information. Maximum delay is 60 seconds. Response includes actual delay time and timestamps.
GET:curl "http://localhost:5000/delay/3"
10 sec:curl "http://localhost:5000/delay/10"
Timing:time curl "http://localhost:5000/delay/5"
Max:curl "http://localhost:5000/delay/60"
Error:curl "http://localhost:5000/delay/120"
GET /base64/encoding/<value>
Encode string to base64url format. Useful for testing base64 encoding/decoding in APIs.
Encode:curl "http://localhost:5000/base64/encoding/hello"
Text:curl "http://localhost:5000/base64/encoding/Hello%20World"
JSON:curl "http://localhost:5000/base64/encoding/$(echo -n '{"key":"value"}' | base64 -w 0)"
GET /base64/decoding/<value>
Decode base64url-encoded string. Returns decoded text or error message for invalid input.
Decode:curl "http://localhost:5000/base64/decoding/aGVsbG8="
Example:curl "http://localhost:5000/base64/decoding/aGVsbG93b3JsZA=="
Invalid:curl "http://localhost:5000/base64/decoding/invalid-base64"
GET /bytes/<n>
Generate n random bytes (max 1MB). Supports optional 'seed' parameter for reproducible output. Returns binary data with application/octet-stream content type.
100 bytes:curl "http://localhost:5000/bytes/100" | wc -c
With seed:curl "http://localhost:5000/bytes/50?seed=12345" | hexdump -C
1KB:curl "http://localhost:5000/bytes/1024" | wc -c
Save file:curl "http://localhost:5000/bytes/500" -o random.bin
GET /uuid
Generate a random UUID4. Returns JSON with UUID and timestamp. Useful for testing unique identifier generation.
GET:curl "http://localhost:5000/uuid"
JSON:curl -s "http://localhost:5000/uuid" | python -m json.tool
Multiple:for i in {1..3}; do curl -s "http://localhost:5000/uuid" | jq .uuid; done
GET /stream/<n>
Stream n JSON responses (max 100). Each response includes request info with incremental ID. Useful for testing streaming data processing.
5 items:curl "http://localhost:5000/stream/5"
Line count:curl -s "http://localhost:5000/stream/10" | wc -l
Process:curl -s "http://localhost:5000/stream/3" | while read line; do echo "Got: $line"; done
GET /stream-bytes/<n>
Stream n random bytes (max 100KB) with configurable chunk size. Supports 'seed' for reproducible output and 'chunk_size' parameter (default 10KB).
1KB:curl "http://localhost:5000/stream-bytes/1024" | wc -c
With seed:curl "http://localhost:5000/stream-bytes/500?seed=42" | hexdump -C | head
Small chunks:curl "http://localhost:5000/stream-bytes/100?chunk_size=10" | wc -c
Save stream:curl "http://localhost:5000/stream-bytes/2048?seed=123" -o stream.bin
GET /drip
Drip data over a specified duration with optional initial delay. Supports parameters: duration (default 2s), numbytes (default 10, max 10MB), code (status code, default 200), delay (initial delay, default 0).
Basic:curl "http://localhost:5000/drip"
Custom:curl "http://localhost:5000/drip?duration=5&numbytes=50"
With delay:curl "http://localhost:5000/drip?delay=2&duration=3&numbytes=20"
Timing:time curl "http://localhost:5000/drip?duration=4&numbytes=100"
GET /links/<n>/<offset>
Generate HTML page with n links to other pages (1-200 links). Useful for testing web crawlers and link following. The offset parameter highlights the current page.
10 links:curl "http://localhost:5000/links/10/0"
Different page:curl "http://localhost:5000/links/10/5"
Max links:curl "http://localhost:5000/links/200/0" | wc -l
Extract links:curl -s "http://localhost:5000/links/5/2" | grep -o 'href="[^"]*"'
GET /range/<numbytes>
Support HTTP range requests for partial content (max 100KB). Supports Range header for byte ranges, plus chunk_size and duration parameters. Returns 206 for partial content, 416 for invalid ranges.
Full:curl -i "http://localhost:5000/range/100"
Range:curl -H "Range: bytes=0-9" -i "http://localhost:5000/range/100"
Last 10:curl -H "Range: bytes=-10" -i "http://localhost:5000/range/100"
From 50:curl -H "Range: bytes=50-" -i "http://localhost:5000/range/100"
Invalid:curl -H "Range: bytes=200-300" -i "http://localhost:5000/range/100"

Cookie Management

GET /cookies
Return cookies sent by client
GET:curl -b "session=abc123;user=test" "http://localhost:5000/cookies"
GET /cookies/set
Set cookies from query parameters and redirect to cookie list. Each query parameter becomes a cookie.
Single:curl -c cookies.txt "http://localhost:5000/cookies/set?session=abc123"
Multiple:curl -c cookies.txt "http://localhost:5000/cookies/set?user=john&theme=dark&lang=en"
Follow:curl -L -c cookies.txt "http://localhost:5000/cookies/set?test=value"
GET /cookies/set/<name>/<value>
Set a specific cookie with name and value, then redirect to cookie list.
Set cookie:curl -c cookies.txt "http://localhost:5000/cookies/set/session/abc123"
Follow redirect:curl -L -c cookies.txt "http://localhost:5000/cookies/set/user/john"
URL encoded:curl -c cookies.txt "http://localhost:5000/cookies/set/message/hello%20world"
GET /cookies/delete
Delete cookies specified in query parameters and redirect to cookie list. Each query parameter name specifies a cookie to delete.
Delete one:curl -b cookies.txt -c cookies.txt "http://localhost:5000/cookies/delete?session"
Delete multiple:curl -b cookies.txt -c cookies.txt "http://localhost:5000/cookies/delete?session&user&theme"
Follow redirect:curl -L -b cookies.txt -c cookies.txt "http://localhost:5000/cookies/delete?test"

Redirects

GET /redirect/<n>
Perform n redirects (302) with optional absolute/relative control. Use ?absolute=true for absolute redirects.
3 redirects:curl -L "http://localhost:5000/redirect/3"
Absolute:curl -L "http://localhost:5000/redirect/2?absolute=true"
No follow:curl -i "http://localhost:5000/redirect/1"
GET /absolute-redirect/<n>
Perform n absolute redirects (302). Always uses absolute URLs in Location header.
2 redirects:curl -L "http://localhost:5000/absolute-redirect/2"
Headers:curl -i "http://localhost:5000/absolute-redirect/1"
GET /relative-redirect/<n>
Perform n relative redirects (302). Uses relative URLs in Location header.
3 redirects:curl -L "http://localhost:5000/relative-redirect/3"
Headers:curl -i "http://localhost:5000/relative-redirect/1"
Verbose:curl -v -L "http://localhost:5000/relative-redirect/2"
GET POST PUT DELETE PATCH TRACE /redirect-to
Redirect to any URL with custom 3XX status code. Requires 'url' and 'status_code' query parameters. Returns 400 if parameters are missing or invalid.
Basic redirect:curl -i "http://localhost:5000/redirect-to?url=http://example.com&status_code=302"
Relative URL:curl -L "http://localhost:5000/redirect-to?url=/ip&status_code=301"
Different status:curl -i "http://localhost:5000/redirect-to?url=/json&status_code=307"
POST method:curl -X POST -i "http://localhost:5000/redirect-to?url=/post&status_code=303"
PUT method:curl -X PUT -i "http://localhost:5000/redirect-to?url=/put&status_code=308"
Invalid (400):curl -i "http://localhost:5000/redirect-to?url=test"

Images

GET /image
Return image based on Accept header. Supports PNG, JPEG, WebP, and SVG formats. Returns 406 if unsupported format requested.
Default (PNG):curl "http://localhost:5000/image" -o image.png
Request JPEG:curl -H "Accept: image/jpeg" "http://localhost:5000/image" -o image.jpg
Request WebP:curl -H "Accept: image/webp" "http://localhost:5000/image" -o image.webp
Request SVG:curl -H "Accept: image/svg+xml" "http://localhost:5000/image" -o image.svg
Unsupported:curl -H "Accept: image/gif" "http://localhost:5000/image"
GET /image/png
Return a simple PNG image.
Save PNG:curl "http://localhost:5000/image/png" -o pig.png
View headers:curl -I "http://localhost:5000/image/png"
GET /image/jpeg
Return a simple JPEG image.
Save JPEG:curl "http://localhost:5000/image/jpeg" -o jackal.jpg
View headers:curl -I "http://localhost:5000/image/jpeg"
GET /image/webp
Return a simple WebP image.
Save WebP:curl "http://localhost:5000/image/webp" -o wolf.webp
View headers:curl -I "http://localhost:5000/image/webp"
GET /image/svg
Return a simple SVG image.
Save SVG:curl "http://localhost:5000/image/svg" -o logo.svg
View SVG:curl "http://localhost:5000/image/svg"

System

GET /health
Health check endpoint
GET:curl "http://localhost:5000/health"
GET /api
API information and endpoint list
GET:curl "http://localhost:5000/api"