RSS Amplifier

Diary of a Web Developer · Apr 1, 2024

HTTP 418: The Status Code Defined as an April Fools’ Joke

0
Sign in to vote or save

Anthony Fung · Diary of a Web Developer

A slight change of pace this week. As it’s the first week of April, I thought it might be fun to look at one of the more light-hearted aspects of Web development.

When building an HTTP service, it’s important to give feedback to requests sent to it. There’s a range of status codes we can use to do this. As each one isn’t too specific, there’s usually one that’s appropriate.

Broadly speaking, there are five ranges:

  • 1xx for information.

  • 2xx indicates success.

  • 3xx for redirecting requests.

  • 4xx suggests something wrong with/related to the request being sent.

  • 5xx shows a problem on the server.

In 1998, status code 418 was defined in RFC 2324:

Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout.

While initially included as an April Fools joke, 418 is a valid status code – according to MDN:

Some websites use this response for requests they do not wish to handle, such as automated queries.

In Microsoft Word, you can triple-click on some text to quickly select the entire paragraph that it’s in. This can also work in some other text editors and browsers too.

These tips are exclusively for my Substack subscribers and readers, as a thank-you for being part of this journey. Some may be expanded into fuller articles in future, depending on their depth.

But you get to see them here, first.

No posts

Read the original on webdeveloperdiary.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.