httpfake dev - fake HTTP/HTTPS answers and TLS failures for automated tests Full documentation: http://statuslab.sample.li/docs Every endpoint below works on http://statuslab.sample.li/ and https://statuslab.sample.li/ (and on every TLS test port), with any method. Common query parameters: ?delay=500ms (wait before answering) ?header=Name:Value (add a response header, repeatable) STATUS CODES /{code} e.g. /404 /500 /503 (any 200-599) /status/{code} same; options: ?retry_after=N ?location=/path ?body=text ?content_type=... /status/200,500,503 random pick /status/200:9,500:1 weighted random (90% 200, 10% 500) TIMING /delay/{ms|2s|1m} answer 200 after the delay (max 5m); ?code=503 to answer something else /timeout never answers (closes after ?max=, default 10m) /slow-body?duration=10s sends the body slowly (?size=1000 ?chunks=10) STATEFUL (great for retry/backoff tests) /ratelimit/{limit}/{window} e.g. /ratelimit/5/60s : 5 requests allowed per 60s per client IP, then 429 + Retry-After add ?key=my-test to get a separate counter /flaky/{n}/{key} first n calls fail (default 503), then 200. ?fail=500|429|drop|reset|timeout reset with DELETE or ?reset=1 BROKEN CONNECTIONS / RESPONSES /drop closes the connection without answering /reset TCP reset (RST) /partial Content-Length says 1000, sends 500 bytes, closes (?size=) /malformed invalid HTTP (?type=garbage|status|header|length|chunked), HTTP/1.1 only /bad-gzip Content-Encoding: gzip with a non-gzip body /bad-json 200 with truncated JSON /redirect/{n} chain of n redirects then 200 (?code=301|302|303|307|308) /redirect-loop redirects to itself forever MISC /echo returns your request as JSON (headers, body, TLS info) /bytes/{n} n random bytes (max 50MB) /auth/basic/{user}/{pass} 401 unless the right Basic credentials are sent /auth/bearer/{token} 401 without token, 403 with a wrong one, 200 otherwise /certs/ca.pem test root CA (trust it to get the precise TLS errors below) /certs/client.pem|.key client certificate for the mtls-required port /health TLS TEST PORTS (https://statuslab.sample.li:PORT/... — all HTTP endpoints above are served on each) 443 valid certificate signed by the httpfake test CA (trust /certs/ca.pem) 8443 expired certificate expired 30 days ago 8444 not-yet-valid certificate only valid from 30 days in the future 8445 wrong-host certificate issued for wrong-host.invalid only 8446 self-signed self-signed certificate (no CA) 8447 unknown-ca signed by a root CA nobody has 8448 incomplete-chain signed by an intermediate CA that the server does NOT send 8449 wrong-usage certificate only allowed for client auth (EKU), not server auth 8450 weak-key RSA 1024-bit key 8451 sha1 certificate signed with SHA-1 8452 cn-only IP only in the Common Name, no Subject Alt Name 8453 tls1.0-only valid certificate, but only TLS 1.0 offered 8454 tls1.1-only valid certificate, but only TLS 1.1 offered 8455 tls1.3-only valid certificate, TLS 1.3 only (fails for TLS 1.2-max clients) 8456 mtls-required valid certificate, server requires a client certificate (/certs/client.pem) 8457 handshake-alert answers the ClientHello with a TLS handshake_failure alert 8458 close-on-hello reads the ClientHello then closes the TCP connection 8459 reset-on-hello reads the ClientHello then sends a TCP RST 8460 hang accepts TCP but never answers the handshake (10 min) 8461 plain-http plain HTTP server on a port you call with https:// 8462 full-chain CONTROL: valid leaf + intermediate sent (works when ca.pem is trusted) Tip: run `curl --cacert ca.pem ...` so the client sees the precise error instead of 'unknown CA'.