Live data from Hacker News

HTTP Status 418 – I'm a teapot

developer.mozilla.org

81–90 of 114 posts

Re: HTTP Status 418 – I'm a teapot

#81
post #50
post #46

Earlier quoted context omitted.

To toot my own horn, I did an April Fool’s status code RFC: 397 Tolerating, for when a client sends a flawed request, but you’re going to tolerate it because you know what they really meant: https://pastebin.com/TPj9RwuZ

This is a good idea for APIs that allow you to update an object by sending a partial JSON object with the keys you want to update, when technically you’re supposed to send the entire updated object representation unless JSON Patch is being used.

Alternatively there actually is a HTTP PATCH verb that you can use for this - I think that tolerating is more appropriate for common misspellinks - i.e. accepting a request like an HTTP POST {"days": 12, "horus": 13 "minutes": 27}

Re: HTTP Status 418 – I'm a teapot

#82
post #40

Earlier quoted context omitted.

Any links to APIs that implement a 418 HTTP response code?

If you have an IoT teapot, when do you return it?

From the docs:

> ... indicates that the server refuses to brew coffee because it is, permanently, a teapot.

So I guess, when it is asked to perform coffee brewing? But pay close attention, to your general purpose brewer:

> A combined coffee/tea pot that is temporarily out of coffee should instead return 503.

Re: HTTP Status 418 – I'm a teapot

#83
post #40

Earlier quoted context omitted.

I still love that people actually went through the effort to "implement" it.

Any links to APIs that implement a 418 HTTP response code?

I added the 418 response code to my gopher server [1]. There was one web bot that constantly hit it and was clueless that it wasn't a web server. It finally got a clue.

[1] https://github.com/spc476/port70

Re: HTTP Status 418 – I'm a teapot

#84

It's all fun and games until some clever developer uses this error code in a production system and the client developer or SRE folks have no idea what it means. Have also seen error code 420 used this way.

I was counting on that when I added status 418 to my gopher server. It shut a particular web bot right up when I did that.

Re: HTTP Status 418 – I'm a teapot

#86
post #81
post #50

Earlier quoted context omitted.

This is a good idea for APIs that allow you to update an object by sending a partial JSON object with the keys you want to update, when technically you’re supposed to send the entire updated object representation unless JSON Patch is being used.

Alternatively there actually is a HTTP PATCH verb that you can use for this - I think that tolerating is more appropriate for common misspellinks - i.e. accepting a request like an HTTP POST {"days": 12, "horus": 13 "minutes": 27}

But what happens when the API is updated to support Egyptian gods as keys?

Re: HTTP Status 418 – I'm a teapot

#87

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

Yeah, code reviews definitely killed some of the fun in coding, they are rarely performed with humor.

Re: HTTP Status 418 – I'm a teapot

#89
post #40

Earlier quoted context omitted.

I still love that people actually went through the effort to "implement" it.

Any links to APIs that implement a 418 HTTP response code?

I sometimes return a 418 when request heuristics detect bad behavior that looks intentional. I don’t document it, though.

Re: HTTP Status 418 – I'm a teapot

#90

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.

Ah, the good ol' 420 - EnhanceYourCalm

[deleted]
Post reply on HN