HTTP Response Test Harness

Generate deliberate HTTP responses for testing monitors, clients, retry logic, redirects, rate limits, error handling and other HTTP-aware software.

Inspired by and credited to Aaron Powell's httpstat.us project , which provides the original simple idea of requesting a status-code URL and receiving that status in response. This is an independent PHP implementation with additional dynamic headers, weighted random responses and test behaviour.

Quick start

Fixed response

https://httpstatus.errorlabs.com/200
https://httpstatus.errorlabs.com/404
https://httpstatus.errorlabs.com/503

Sequenced responses

https://httpstatus.errorlabs.com/200,404,200,302
https://httpstatus.errorlabs.com/200x5,404,500x2
https://httpstatus.errorlabs.com/200,404,200,302?reset=1

Without the /random/ prefix, a comma-separated list is a deterministic sequence. Numeric multipliers repeat a status in-place, so /200x5,404,500x2 is equivalent to five 200 responses, then 404, then two 500 responses. Each request advances to the next logical status and the sequence repeats after the final item. Sequence state is tracked per client session and per sequence definition.

?reset=1 resets that sequence before returning the first item.

Random responses

https://httpstatus.errorlabs.com/random
https://httpstatus.errorlabs.com/random/200,404,500
https://httpstatus.errorlabs.com/random/2xx,4xx,5xx

Weighted random responses

https://httpstatus.errorlabs.com/random/200,200,404
https://httpstatus.errorlabs.com/random/200x2,404
https://httpstatus.errorlabs.com/random/200x4,404
https://httpstatus.errorlabs.com/random/200x95,404x3,500x2

Repetition and multipliers both control probability. For example, /random/200,200,404 and /random/200x2,404 are equivalent. The multiplier form is easier to read for larger distributions such as /random/200x95,404x3,500x2.

Numeric multipliers are supported up to x10000. Status classes such as 2xx can be repeated for weighting.

Build a test URL

Query controls

Parameter Example Behaviour
delay=0 /504?delay=0 Disable any status-specific simulated delay.
delay=<ms> /200?delay=1500 Force a delay in milliseconds, capped at 30 seconds.
delay=random /200?delay=random Random delay between 50 and 5000 ms.
body=0 /404?body=0 Suppress the response body.
format=json /429?format=json Force JSON.
format=html /429?format=html Force HTML.
format=markdown /429?format=markdown Force Markdown.
format=text /429?format=text Force plain text.
reset=1 /200,404,500?reset=1 Reset the current client's sequence and return its first item.

Content negotiation

Without a ?format= override, the service uses the request's Accept header and supports:

text/html
application/json
text/markdown
text/plain

Normal browser navigation prefers HTML. Accept: */* defaults to JSON. Content-negotiated responses include Vary: Accept.

Sequence diagnostics

X-Test-Sequence
X-Test-Sequence-Position
X-Test-Sequence-Length
X-Test-Sequence-Loop
X-Test-Sequence-Request
X-Test-Sequence-Next

Positions and loop counters are one-based, so the first pass through a sequence is loop 1.

What varies between requests?

Where appropriate, values such as Retry-After, Location, ETags, rate-limit metadata, request IDs, authentication realms, content ranges and simulated delays are generated dynamically. This lets test clients act on the values they actually receive.

Important limitations

This is an application-level simulator. Informational 1xx responses, nginx 444 connection-closing behaviour, genuine TCP failures, TLS handshake failures and true network-level timeouts cannot all be reproduced perfectly from PHP behind a conventional web server.

Status catalogue

Code Reason Classification Reference
100 Continue IANA IANA registry
101 Switching Protocols IANA IANA registry
102 Processing IANA / WebDAV IANA registry
103 Early Hints IANA IANA registry
104 Upload Resumption Supported IANA temporary registration IANA registry
200 OK IANA IANA registry
201 Created IANA IANA registry
202 Accepted IANA IANA registry
203 Non-Authoritative Information IANA IANA registry
204 No Content IANA IANA registry
205 Reset Content IANA IANA registry
206 Partial Content IANA IANA registry
207 Multi-Status IANA / WebDAV IANA registry
208 Already Reported IANA / WebDAV IANA registry
218 This Is Fine Non-standard / Apache Unofficial references
226 IM Used IANA IANA registry
300 Multiple Choices IANA IANA registry
301 Moved Permanently IANA IANA registry
302 Found IANA IANA registry
303 See Other IANA IANA registry
304 Not Modified IANA IANA registry
305 Use Proxy IANA / deprecated IANA registry
306 Switch Proxy Unused / historical Unofficial references
307 Temporary Redirect IANA IANA registry
308 Permanent Redirect IANA IANA registry
400 Bad Request IANA IANA registry
401 Unauthorized IANA IANA registry
402 Payment Required IANA / reserved semantics IANA registry
403 Forbidden IANA IANA registry
404 Not Found IANA IANA registry
405 Method Not Allowed IANA IANA registry
406 Not Acceptable IANA IANA registry
407 Proxy Authentication Required IANA IANA registry
408 Request Timeout IANA IANA registry
409 Conflict IANA IANA registry
410 Gone IANA IANA registry
411 Length Required IANA IANA registry
412 Precondition Failed IANA IANA registry
413 Content Too Large IANA IANA registry
414 URI Too Long IANA IANA registry
415 Unsupported Media Type IANA IANA registry
416 Range Not Satisfiable IANA IANA registry
417 Expectation Failed IANA IANA registry
418 I'm a Teapot Historical / RFC 2324; IANA currently marks 418 unused RFC 2324
419 Page Expired Non-standard / Laravel Unofficial references
420 Enhance Your Calm Non-standard / historical Twitter Unofficial references
421 Misdirected Request IANA IANA registry
422 Unprocessable Content IANA IANA registry
423 Locked IANA / WebDAV IANA registry
424 Failed Dependency IANA / WebDAV IANA registry
425 Too Early IANA IANA registry
426 Upgrade Required IANA IANA registry
428 Precondition Required IANA IANA registry
429 Too Many Requests IANA IANA registry
431 Request Header Fields Too Large IANA IANA registry
440 Login Time-out Non-standard / Microsoft IIS Unofficial references
444 No Response Non-standard / nginx nginx source
449 Retry With Non-standard / Microsoft IIS Unofficial references
450 Blocked by Windows Parental Controls Non-standard / Microsoft Unofficial references
451 Unavailable For Legal Reasons IANA IANA registry
460 Client Closed Connection Non-standard / AWS Unofficial references
463 Too Many Forwarded IP Addresses Non-standard / AWS Unofficial references
494 Request Header Too Large Non-standard / nginx nginx source
495 SSL Certificate Error Non-standard / nginx nginx source
496 SSL Certificate Required Non-standard / nginx nginx source
497 HTTP Request Sent to HTTPS Port Non-standard / nginx nginx source
498 Invalid Token Non-standard / ArcGIS Unofficial references
499 Client Closed Request Non-standard / nginx nginx source
500 Internal Server Error IANA IANA registry
501 Not Implemented IANA IANA registry
502 Bad Gateway IANA IANA registry
503 Service Unavailable IANA IANA registry
504 Gateway Timeout IANA IANA registry
505 HTTP Version Not Supported IANA IANA registry
506 Variant Also Negotiates IANA IANA registry
507 Insufficient Storage IANA / WebDAV IANA registry
508 Loop Detected IANA / WebDAV IANA registry
509 Bandwidth Limit Exceeded Non-standard Unofficial references
510 Not Extended IANA / obsolete IANA registry
511 Network Authentication Required IANA IANA registry
520 Web Server Returned an Unknown Error Non-standard / Cloudflare Cloudflare docs
521 Web Server Is Down Non-standard / Cloudflare Cloudflare docs
522 Connection Timed Out Non-standard / Cloudflare Cloudflare docs
523 Origin Is Unreachable Non-standard / Cloudflare Cloudflare docs
524 A Timeout Occurred Non-standard / Cloudflare Cloudflare docs
525 SSL Handshake Failed Non-standard / Cloudflare Cloudflare docs
526 Invalid SSL Certificate Non-standard / Cloudflare Cloudflare docs
527 Railgun Error Non-standard / historical Cloudflare Cloudflare docs
529 Site Is Overloaded Non-standard Unofficial references
530 Site Is Frozen Non-standard / Pantheon Unofficial references
540 Temporarily Disabled Non-standard / Shopify Unofficial references
561 Unauthorized Non-standard / AWS Unofficial references
598 Network Read Timeout Error Non-standard / proxy convention Unofficial references
599 Network Connect Timeout Error Non-standard / proxy convention Unofficial references
783 Unexpected Token Non-standard / Shopify Unofficial references
999 Request Denied Non-standard / LinkedIn Unofficial references

Credits

Project: github.com/lucanos/httpstatus

Inspired by Aaron Powell's httpstatus project , which is also distributed under the MIT License.