eggfetch includes a full-featured command-line HTTP client. It supports all HTTP methods, headers, request bodies, multipart uploads, authentication, proxies, retries, streaming, and machine-readable output formats.
# From source (requires Rust toolchain)
cargo install --path crates/eggfetch-cli
# Or via cargo install from a registry
cargo install eggfetch-cli# GET request (default method)
eggfetch https://example.com
# POST with a body
eggfetch -X POST https://api.example.com/data --json '{"key": "value"}'
# Follow redirects (on by default)
eggfetch https://example.com/redirect --followUse -X or --method to specify the HTTP method. If omitted, the method is auto-detected: POST when a body is provided, GET otherwise.
eggfetch -X GET https://example.com
eggfetch -X POST https://api.example.com
eggfetch -X PUT https://api.example.com/resource
eggfetch -X PATCH https://api.example.com/resource
eggfetch -X DELETE https://api.example.com/resource
eggfetch -X HEAD https://example.com
eggfetch -X OPTIONS https://example.comAdd headers with -H. Can be repeated.
eggfetch -H "Accept: application/json" -H "X-Custom: value" https://example.comAdd query parameters with -q. Can be repeated.
eggfetch -q "q=rust" -q "page=1" https://api.example.com/searcheggfetch -X POST --body "raw payload" https://example.comeggfetch -X POST --body-file payload.json https://example.com
eggfetch -X POST --body-file - https://example.com # read from stdinAutomatically sets Content-Type: application/json.
eggfetch -X POST --json '{"name": "Alice", "age": 30}' https://api.example.com/usersEncodes as application/x-www-form-urlencoded.
eggfetch -X POST --form "name=Alice" --form "age=30" https://example.comUse --file for multipart form-data. Format: NAME=@PATH[:FILENAME].
eggfetch -X POST --file "document=@report.pdf" https://upload.example.com
eggfetch -X POST --file "photo=@image.jpg:avatar.jpg" https://upload.example.comCombine with form fields:
eggfetch -X POST \
--form "description=My photo" \
--file "photo=@photo.jpg" \
https://upload.example.comeggfetch -o response.json https://example.comDerives filename from Content-Disposition or the URL path.
eggfetch --download https://example.com/file.zipeggfetch --download --no-clobber https://example.com/file.zipeggfetch -i https://example.comeggfetch --headers-only https://example.comeggfetch --no-body https://example.comStructured JSON with status, headers, body, and timing.
eggfetch --json-output https://example.comOne JSON object per line, useful for piping.
eggfetch --ndjson https://api.example.com/streamFor binary responses.
eggfetch --json-output --base64 https://example.com/binary-fileApplies to pool, connect, write, and read phases.
eggfetch --timeout 30 https://example.comeggfetch --connect-timeout 5 --read-timeout 60 https://slow.example.com
eggfetch --total-timeout 120 https://example.comFollow redirects is on by default (up to 20). Disable or customize:
eggfetch --follow https://example.com/redirect
eggfetch --no-follow https://example.com/redirect
eggfetch --max-redirects 5 https://example.com/redirect
eggfetch --no-downgrade https://example.com/redirect--no-downgrade rejects https -> http redirect downgrades instead of
following them.
eggfetch --auth "user:password" https://api.example.comeggfetch --bearer "my-token" https://api.example.comeggfetch --cookie "session=abc123" --cookie "lang=en" https://example.comRead and write cookies to a file:
eggfetch --cookie-jar cookies.txt https://example.com/login
eggfetch --cookie-jar cookies.txt https://example.com/dashboard# HTTP proxy
eggfetch --proxy "http://proxy:8080" https://example.com
# Proxy with authentication
eggfetch --proxy "http://proxy:8080" --proxy-auth "user:pass" https://example.com
# NO_PROXY bypass
eggfetch --proxy "http://proxy:8080" --no-proxy "localhost,.internal.com" https://example.comeggfetch --no-verify https://self-signed.example.comeggfetch --cacert /path/to/ca-bundle.pem https://example.comeggfetch --cert /path/to/cert.pem --key /path/to/key.pem https://example.comeggfetch --retry 3 https://api.example.com
eggfetch --retry 5 --retry-delay 2 https://api.example.comeggfetch --http1 https://example.com
eggfetch --http2 https://example.com
eggfetch --http3 https://example.com--http2/--http3 require a CLI build with the corresponding core feature
compiled in. The default build enables cookies, multipart, and proxy
but not http2 or http3; requesting an uncompiled protocol fails
instead of silently downgrading. --http3 (QUIC) is experimental.
The default CLI build compiles no compression decoders and never sends
Accept-Encoding, so compliant servers reply identity-encoded. If a server
sends an encoded body anyway, decoding fails (exit 5) unless
--no-compress passes the bytes through raw:
# Pass the body through without decoding (also skips Accept-Encoding)
eggfetch --no-compress https://example.com
# Limit decoded body size
eggfetch --max-body-size 10485760 https://example.com
# Limit decompression ratio (guards against zip bombs)
eggfetch --max-decompression-ratio 100.0 https://example.comExit with code 6 on any non-2xx response:
eggfetch --check-status https://example.com/404
echo $? # 6Verbose mode prints request and response details:
eggfetch -v https://example.comGenerate shell completions for bash, zsh, fish, PowerShell, or elvish:
eggfetch --generate-completion bash > /etc/bash_completion.d/eggfetch
eggfetch --generate-completion zsh > ~/.zfunc/_eggfetch
eggfetch --generate-completion fish > ~/.config/fish/completions/eggfetch.fish| Variable | Description |
|---|---|
EGGFETCH_AUTH |
Basic auth as USER:PASS |
EGGFETCH_BEARER |
Bearer token |
EGGFETCH_PROXY |
Proxy URL |
EGGFETCH_PROXY_AUTH |
Proxy auth as USER:PASS |
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Usage error (bad arguments, invalid URL) |
| 3 | Connection error (network, TLS, proxy) |
| 4 | Timeout |
| 5 | Protocol error (HTTP/2, decompression, redirects) |
| 6 | HTTP status error (with --check-status, on any non-2xx) |
| 7 | I/O error |
| 130 | Interrupted (Ctrl+C) |
# Fetch JSON from an API
eggfetch -H "Accept: application/json" https://api.example.com/users
# Create a resource
eggfetch -X POST \
-H "Content-Type: application/json" \
--json '{"name": "Alice", "email": "alice@example.com"}' \
https://api.example.com/users
# Authenticate
eggfetch --bearer "$TOKEN" https://api.example.com/me# Download a file
eggfetch --download https://example.com/archive.tar.gz
# Download with progress (verbose)
eggfetch -v --download https://example.com/large-file.zip
# Pipe to another command
eggfetch https://api.example.com/data | jq '.results[]'# Extract a field from JSON response
eggfetch --json-output https://api.example.com/status | jq '.status'
# Post and check response
eggfetch --json-output -X POST --json '{"query": "test"}' https://api.example.com/search | jq '.count'eggfetch \
-X GET \
-H "Accept: application/json" \
--bearer "$API_TOKEN" \
--proxy "http://corporate-proxy:8080" \
--retry 3 \
--timeout 30 \
--json-output \
https://api.example.com/data