Basic Usage¶
Command-Line Interface¶
The httptap command-line interface provides various options to customize your HTTP requests and output.
Syntax¶
Options¶
Curl compatibility: Common curl flags are accepted as aliases. Swap
curlforhttptapand keep using familiar options like-X/--request,-L/--location,-m/--max-time,-k/--insecure,-x, and--http1.1. This is not a full curl clone—stick to the overlapping flags listed here.
Request Options¶
-X, --request, --method METHOD¶
Specify the HTTP method to use. Supported methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
Curl-compatible aliases: -X, --request.
Default behavior:
- Without --data: defaults to GET
- With --data but no --method: auto-switches to POST (similar to curl)
- With explicit --method: respects the specified method
-d, --data DATA¶
Send request body data. Can be inline string or file reference using @filename syntax.
Inline JSON data:
Load from file:
Auto-detection: - Content-Type is automatically detected (JSON, XML, plain text) - File extension is checked first (.json, .xml, .txt) - Falls back to JSON validation
Examples with different methods:
# POST (auto-detected when --data is present)
httptap --data '{"key": "value"}' https://httpbin.io/post
# PUT
httptap --method PUT --data '{"status": "updated"}' https://httpbin.io/put
# PATCH
httptap --method PATCH --data '{"field": "modified"}' https://httpbin.io/patch
# Explicit GET with body (uncommon, triggers warning)
httptap --method GET --data 'query-data' https://httpbin.io/get
-H, --header¶
Add custom HTTP headers to the request. Can be used multiple times.
httptap \
-H "User-Agent: MyApp/1.0" \
-H "Authorization: Bearer token123" \
https://httpbin.io/bearer
-L, --location, --follow¶
Follow HTTP redirects and show timing for each step in the chain (max 10 redirects).
Curl-compatible aliases: -L, --location.
By default, httptap does not follow redirects and will stop at the first redirect response (3xx status code).
-m, --max-time, --timeout SECONDS¶
Abort the request chain if total elapsed time exceeds the specified number of seconds.
Curl-compatible aliases: -m, --max-time.
Default timeout is 20 seconds.
--no-http2 / --http1.1¶
Disable HTTP/2 negotiation and force HTTP/1.1 connections.
By default, HTTP/2 is enabled if the server supports it.
Curl-compatible alias: --http1.1.
-k, --insecure, --ignore-ssl¶
Disable TLS certificate verification. Useful for debugging self-signed hosts or expired certificates.
Warning
Use this option only on trusted networks. It disables certificate validation and relaxes handshake constraints.
Curl-compatible aliases: -k, --insecure.
-x, --proxy URL¶
Route requests through the specified proxy. Supports HTTP, HTTPS, SOCKS5, and SOCKS5H protocols.
Curl-compatible alias: -x.
# HTTP proxy
httptap --proxy http://proxy.local:8080 https://httpbin.io/get
# SOCKS5 proxy
httptap --proxy socks5h://proxy.local:1080 https://httpbin.io/get
The proxy setting takes precedence over environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY).
Output Options¶
--compact¶
Display results in a compact single-line format, suitable for logging.
Output:
--metrics-only¶
Output raw metrics without formatting, ideal for scripting and automation.
Output:
Step 1: dns=30.1 connect=97.3 tls=199.0 ttfb=472.2 total=476.0 status=200 bytes=389 ip=44.211.11.205 family=IPv4 tls_version=TLSv1.2
--json PATH¶
Export full request data to a JSON file.
The JSON file contains:
- Timing breakdown for all phases
- Network information (IP address, TLS details, certificate info)
- Response metadata (status, headers, body size)
- Complete redirect chain (when using
--follow)
--version¶
Display the httptap version and Python runtime information.
HTTP Methods¶
httptap supports all standard HTTP methods:
- GET - Retrieve resource (default when no
--datais provided) - POST - Create/submit resource (auto-selected when
--datais provided) - PUT - Replace resource
- PATCH - Partially update resource
- DELETE - Remove resource
- HEAD - Get headers only
- OPTIONS - Query allowed methods
Method Selection Logic¶
- Explicit method:
--methodalways takes precedence - Auto-POST: When
--datais present without--method, defaults to POST - Default GET: Without
--dataor--method, uses GET
Examples by Use Case¶
API Testing:
# Create resource
httptap --data '{"title": "New Post"}' https://httpbin.io/post
# Update resource
httptap --method PUT --data '{"title": "Updated"}' https://httpbin.io/put
# Partial update
httptap --method PATCH --data '{"status": "published"}' https://httpbin.io/patch
# Delete resource
httptap --method DELETE https://httpbin.io/delete
Health Checks:
# Quick check (headers only)
httptap --method HEAD https://httpbin.io/status/200
# Full response
httptap https://httpbin.io/status/200
Request Flow¶
Every httptap request follows these phases:
- DNS Resolution - Domain name lookup
- TCP Connect - Establish TCP connection
- TLS Handshake - Negotiate secure connection (HTTPS only)
- Server Wait - Time between request sent and first response byte
- Body Transfer - Download response body
Understanding Output¶
Rich Mode (Default)¶
The default rich output displays a waterfall table with:
- Phase name and duration
- Visual progress bar
- Network details (IP, TLS version, certificate info)
- Response metadata (status, size, content-type)
Timing Breakdown¶
- DNS (ms) - Time to resolve domain to IP address
- Connect (ms) - Time to establish TCP connection
- TLS (ms) - Time for TLS handshake (HTTPS only)
- TTFB (ms) - Time to first byte (includes server processing)
- Transfer (ms) - Time to download response body
- Total (ms) - End-to-end request duration
Network Information¶
- IP Address - Resolved IP address and family (IPv4/IPv6)
- TLS Version - Protocol version (TLS 1.2, TLS 1.3)
- Cipher Suite - Negotiated cipher suite
- Certificate CN - Common Name from server certificate
- Certificate Expiry - Days until certificate expires
Examples¶
Basic Health Check¶
API Request with Authentication¶
httptap \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/json" \
https://httpbin.io/bearer
Follow Redirect Chain¶
Export for Analysis¶
Log to File¶
What's Next?¶
-
Rich, compact, JSON, and metrics modes
-
Custom components and programmatic usage
-
Extend httptap with protocols