TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Reserve the 418 status code

195 pointsby BenjaminCoealmost 8 years ago

7 comments

robotmayalmost 8 years ago
I actually use the 418 code in a simple API we use for IOT devices. I wrote a small program that runs on Raspberry Pis that checks a HTTP endpoint and turns power on and off to a room depending on whether the room is booked out. I wanted a status code on the API that could only possibly be generated on purpose, so if it receives a 418 response it knows to turn off the power; any other response, failure etc turns the power on (so we don&#x27;t have a room out of use if it breaks).<p>Also it&#x27;s fun :)
评论 #15007935 未加载
评论 #15007880 未加载
joombagaalmost 8 years ago
Why is 418 the particular target? Just because of RFC2324?<p>&gt; IANA should also typographically distinguish “Unassigned” and “Reserved” in the registry descriptions, to prevent confusion.<p>This I can get onboard with. Honestly, I&#x27;ve never seen a 418 easter egg, but I&#x27;d think it would be an HTTP spec violation if it didn&#x27;t at least conform to the higher level 4xx definition (Client Error) :)
评论 #15005852 未加载
评论 #15007194 未加载
评论 #15005749 未加载
评论 #15005769 未加载
评论 #15005855 未加载
评论 #15006861 未加载
grandalfalmost 8 years ago
Many API developers misuse&#x2F;overload HTTP status codes when they should actually be using application specific status codes delivered via a wrapper to the response.<p>Any time an API returns a correct response the HTTP response code should be 2xx. Many developers use 4xx status codes to indicate things like data validation errors or other things that are not part of the HTTP transport.<p>HTTP is the transport layer, and any application specific scenarios are best handled with a custom error namespace that can be returned within any 2xx HTTP response.<p>Generally speaking, if the HTTP layer is returning 5xx you have a server problem and client code should not know anything about that or do anything but retry. If the HTTP layer is returning 4xx then the client is likely poorly designed or misconfigured.<p>But for typical client operation, when there is no server error or client design&#x2F;configuration error, HTTP responses should be 2xx or 3xx and any additional detail should be handled in an application-specific way, not by overloading the meaning of HTTP response codes, which are for transport-related concerns only.
评论 #15008945 未加载
评论 #15008285 未加载
评论 #15009038 未加载
评论 #15008418 未加载
评论 #15008230 未加载
评论 #15008000 未加载
评论 #15009039 未加载
ara24almost 8 years ago
We can never fix the &quot;Referer&quot; header, and we have accepted it! So, why not accept 418 for what it is ? Let it at-least complete its 20th year.<p>HTTP&#x2F;1.1 418 I&#x27;m a Teapot
synthmeatalmost 8 years ago
Yeah, I&#x27;m sorry, but now we need to standardize BREW HTTP verb.<p><a href="https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc2324" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc2324</a>
bjournealmost 8 years ago
I&#x27;m somewhat interested in spec writing and legal matters. It seem to me, that this rfc is overly verbose given the change it proposes. And (I think, correct me if I&#x27;m wrong) rfc:s are generally supposed to be as short as possible.<p>For example, &quot;IANA should also typographically distinguish “Unassigned” and “Reserved” in the registry descriptions, to prevent confusion.&quot; seem like a good idea but is an unrelated matter.
apialmost 8 years ago
Of course nowadays it actually <i>could</i> be a teapot.
评论 #15015035 未加载