This is a super simple service for generating different HTTP codes.
It's useful for testing how your own scripts deal with varying responses.
Just add the status code you want to the host name, like this: http://567.returnco.de
We'll return an empty response:
# curl -i http://567.returnco.de HTTP/1.1 567 X-returnco-de: 567 Content-Length: 0 Date: Sat, 10 Dec 2016 21:52:23 GMT Server: lighttpd
The status code can be specified in three ways:
- The desired return code can be put into the host part of the request, as in http://567.returnco.de On the server side, this is read from the HTTP/1.1 "Host" header that's sent by all today's clients automatically.
- It can be specified via the tcp port that you connect to, again identified via Host header, as in http://returnco.de:567
- When you really can't or do not want to send a Host header, path-style requests like http://returnco.de/567 work here, too. Unfortunately, it is not possible to use a fragment (e.g. http://returnco.de/page#567), because fragments are client-side only and are not sent to the server.
The host and path options should work over both HTTP as well as HTTPS/TLS. Don't look too closely at the certificate.
Kudos to the folks over at http://httpstat.us for inspiration plus page style and text content. Unlike their service, here you're not limited to just the path of the URI to provoke a specific response.
In practice, it can be much easier to just change the host name or port in your program's configuration rather than trying to get it to request a specific URI!
You can ask for any HTTP status code in the range of 200 to 999. Port tcp/443 is the default port for TLS, so for 443 host or path should be used. The complete list of HTTP/1.1 Status Codes can be found in RFC2616 Section 10. For convenience:
- Non-Authoritative Information
- No Content
- Reset Content
- Partial Content
- Multiple Choices
- Moved Permanently
- See Other
- Not Modified
- Use Proxy
- Temporary Redirect
- Permanent Redirect
- Bad Request
- Payment Required
- Not Found
- Method Not Allowed
- Not Acceptable
- Proxy Authentication Required
- Request Timeout
- Length Required
- Precondition Required
- Request Entry Too Large
- Request-URI Too Long
- Unsupported Media Type
- Requested Range Not Satisfiable
- Expectation Failed G
- I'm a teapot
- Unprocessable Entity
- Precondition Required
- Too Many Requests
- Request Header Fields Too Large
- Unavailable For Legal Reasons
- Internal Server Error
- Not Implemented
- Bad Gateway
- Service Unavailable
- Gateway Timeout
- HTTP Version Not Supported
- Network Authentication Required
- Web server is returning an unknown error
- Connection timed out
- A timeout occurred
Caveats / Bugs:
- The HTTP server hosting this service is unable to handle Transfer-Encoding: chunked requests. This header is ignored. It expects that a Content-Length: ... header is present in all requests. Otherwise, HTTP 411 Length Required is returned instead of the requested return code.
- In the URL, larger numbers are treated as (milli-) seconds and converted to YYYY-MM-DD'T'HH:MI:SS.SSS'Z' as plain body content (RFC3339): /1xxxxxxxx0" (seconds, 3-10 digits) to /1xxxxxxxxxxx9 (millseconds, 11-13 digits).