Httpstat.us: API for generating different HTTP codes.
httpstat.us
httpstat.us
var http = require('http');
http.createServer(function (request, response)
{
var statusCode = request.url.substr(1, 3);
response.writeHead(statusCode, { 'connection' : 'close', 'content-type' : 'text/html' });
response.write('<html>');
response.write('<head><title>' + statusCode + ' ' + http.STATUS_CODES[statusCode] + '</title></head>');
response.write('<body bgcolor="white">');
response.write('<center><h1>' + statusCode + ' ' + http.STATUS_CODES[statusCode] + '</h1></center>');
response.write(' '.repeat(512));
response.write('</body>');
response.end('</html>');
}).listen(8124, "0.0.0.0");
String.prototype.repeat = function(num)
{
return new Array(num++).join(this);
} import time
from flask import Flask, make_response, request
app = Flask(__name__)
@app.route('/<int:status_code>')
def return_status(status_code):
response = make_response()
response.status_code = status_code
response.data = response.status
sleep = request.args.get('sleep', None)
if sleep is not None:
time.sleep(int(sleep))
return response
if __name__ == '__main__':
app.run(debug=True)
With a handy little feature, a "sleep" query string param that'll delay the response for the given number of seconds, which I've used to test how a client handles latency etc.[BTW, looks like you're the Elliot Carlson I used to work with way back when. Hope life is treating you well these days! :)]
2.1.4 WHEN method When coffee is poured, and milk is offered, it is necessary for the holder of the recipient of milk to say "when" at the time when sufficient milk has been introduced into the coffee. For this purpose, the "WHEN" method has been added to HTCPCP. Enough? Say WHEN.
$ curl -v http://httpstat.us/418
* About to connect() to httpstat.us port 80 (#0)
* Trying 75.101.145.87... connected
* Connected to httpstat.us (75.101.145.87) port 80 (#0)
> GET /418 HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: httpstat.us
> Accept: */*
>
< HTTP/1.1 418 Unknown Error
< Server: nginx/0.7.67
< Date: Tue, 15 Feb 2011 16:46:59 GMT
< Content-Type: text/plain
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Content-Length: 16
< X-Varnish: 1137499688
< Age: 0
< Via: 1.1 varnish
<
* Connection #0 to host httpstat.us left intact
* Closing connection #0
418 I'm a TeapotVarnish is certainly stuffing us up a bit. There's a note about this at the bottom of the page.
If I did this again, I wouldn't deploy it to Heroku for this reason.
source code: https://github.com/arthurk/httpstatus
Mostly, we wanted to play with some tech and we came across the domain name httpstat.us which we just thought was cool.
HTTP/1.1 404 Not Found Server: nginx/0.7.67 Date: Tue, 15 Feb 2011 14:13:09 GMT Content-Type: text/plain Access-Control-Allow-Origin: * X-Varnish: 651017685 Age: 0 Via: 1.1 varnish Transfer-Encoding: chunked Proxy-Connection: Keep-Alive Connection: Keep-Alive Content-Encoding: gzip
100 Unknown Status
They seem to simply truncate the number. E.g., http://httpstat.us/39487394587394857349587 returns "394 Unknown status", but http://httpstat.us/200129038123 will return "200 OK"
https://github.com/jonursenbach/http-status-code-definitions
--@slace (co-author of httpstat.us)
Oops, we seem to have a glitch in our system.
We've been notified; you might try reloading the page in a little while.
v 26026 2077752888
I can understand monitoring for a site that -has- to be up (otherwise testing suites would start to break), but not the cloud database, let alone programmable markup or managed hosting (Heroku). Surely all that extra complexity is going to cost more in downtime than the time taken to set things up manually?
http://isitbeerti.me was another experiment of ours on the .NET platform