Is there server software that implements http status code 418?
I know that status code 418 was defined as a April Fools' joke, and "is not expected to be implemented by actual HTTP servers" as is stated on wikipedia (Wiki entry about HTTP codes).
But I would be interested if any of you knew of a language/webserver/IDE that actually supports it.
I was trying on Apache, and obviously it got me an internal error (500) instead. I just like the humor behind it (am not trying to troll here) and would like to know if more than just Emacs implements this.
It could be "emulated" in php for example by doing something like this ...
header("HTTP/1.1 418 Whatever text I'd like");
... but do any of you know an actual server software (or language) that implements it - despite that it is not expected to - where something like the following would actually work (not throw a 500):
http_response_code(418);
Thx!
Google does it.
Try clicking on the teapot, or tilting your mobile device.
www.google.com/teapot
Languages that support it natively
node.js
res.send(418)
Sends following HTTP header:
HTTP/1.1 418 I'm a teapot
Date: Wed, 25 Feb 2015 07:08:27 GMT
Connection: keep-alive
Transfer-Encoding: chunked
The actual node.js code used to get this response was:
require('http').createServer(function(q,s) {
s.writeHead(418);
s.end();
}).listen(80);
Golang
http.Error(w, http.StatusText(418), 418)
Websites that have implemented it
Yes, it is implemented (by a teapot).
This error code is an impotent part of HTCPCP(Hyper Text Coffee Pot Control Protocol).
链接地址: http://www.djcxy.com/p/41168.html