Live data from Hacker News

HTTP Status 418 – I'm a teapot

developer.mozilla.org

111–114 of 114 posts

Re: HTTP Status 418 – I'm a teapot

#111
post #109

Earlier quoted context omitted.

I love the concept. At the firm I work at, one of my "10% time" projects was to build out a "warnings" field in the API response. There are often times that you want to say "this is not inherently wrong, but likely represents wrong assumptions upstream" or "you're asking for something that's obsolete and is now being silently ignored". For example, if someone passes a currency field with the wrong number of decimal p…

To be honest I think the robustness principle isn’t very well supported. We shouldn’t be this accommodating in what we accept. We’re very likely harming users by ignoring errors.

That said we should be much more accommodating in our user interfaces to help prevent this kind of crap data.

Re: HTTP Status 418 – I'm a teapot

#112

I'm personally of the opinion that 418 shouldn't be considered a joke response, but would actually useful as 418 "Unsupported Device". What response should a printer give if you asked it to send a fax, but you have a base-model printer that doesn't support sending faxes. From the perspective of the printer, I know what you want (i.e. not a 404) and you've asked for it correctly (i.e. not 400 or 401 or 403), but I can…

I'd probably use a 422 in that case. I think 422 errors are underused, and can good for communicating errors when a client requests something which doesn't make sense from a business context.

For those that haven't memorized every single HTTP error code, 422 is "Unprocessable Entity": 'the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.'

Re: HTTP Status 418 – I'm a teapot

#113
post #60

I'm personally of the opinion that 418 shouldn't be considered a joke response, but would actually useful as 418 "Unsupported Device". What response should a printer give if you asked it to send a fax, but you have a base-model printer that doesn't support sending faxes. From the perspective of the printer, I know what you want (i.e. not a 404) and you've asked for it correctly (i.e. not 400 or 401 or 403), but I can…

It's complete overlap with 404 IMO

If you throw a 404 to a completely valid GET for a file that doesn't exist for example, how is that a "complete overlap" to something like asking a database REST API to print a PDF? In the latter case, you have the ability to give a more detailed (better) error message, so why shouldn't you?

Re: HTTP Status 418 – I'm a teapot

#114

Earlier quoted context omitted.

If I have anything to do with it, there is a 418 response hidden somewhere. I recall a few internal projects at a previous employer would return 418 if the user managed to royally mess something up as a "wtf, how are you here?!" kind of response. I feel like I am not alone in implementing 'weird' HTTP codes when I get bored / as an easter egg. Pretty sure I also used HTTP 420 at least once.

“Uhh ummm no” -code reviewer

[deleted]
Post reply on HN