40 comments

[ 3.5 ms ] story [ 95.2 ms ] thread
(comment deleted)
I'd prefer a man page than having to install separate tool :)
`man 404` would be really convenient. I could tolerate `man http-404` too.

For those that think that `man` is only about commands, we already have `man 7 ascii`.

FYI: Successful is written without two L's. Looks like a useful tool though :)
I was loving httpstatuses.com, but the domain has been recently sold and lost all the clean style that made it useful.
I sold httpstatuses.com (website and domain) in... 2016 I think, maybe 2017, and the acquirers kept it as-is until 2022. Someone (not me) recently relaunched the site (as it was opensource) under a new domain -- https://httpstatuses.io -- so if you can replace ".com" with ".io" in your muscle memory, you can get the original site!

Their blog post about reviving the project: https://jkulton.com/2022/reviving-httpstatuses

"There's an app for that" now coming to your terminals...!
This looks good.

I use a bash function to load the MDN page for the status:

  function man-http() {
    code="$1"
    if [[ -z $code ]]; then
      echo "Usage: man-http <status code>"
      exit 0
    fi

    firefox "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/$code"  
  }
i keep underestimating the power of bash. KISS!
From your description I thought for a second that you were somehow parsing the page :D
On that note, this is the shell alias I use to remember status codes (using htmlq https://github.com/mgdm/htmlq):

    alias status_codes="curl --silent https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | htmlq --text 'dt a code'"
Prints something like this:

    100 Continue
    101 Switching Protocols
    102 Processing
    103 Early Hints
    200 OK
    201 Created
    202 Accepted
    203 Non-Authoritative Information
    204 No Content
    205 Reset Content
    206 Partial Content
    ...
To get specific groups, I do something like this:

    status_codes | grep ^2
Replacing 2 with whatever group you want, like 4 for 4xx codes for example
Wow, how have i never heard of htmlq!?! Thanks for sharing your alias as well as teaching me another cool tool (htmlq)!
You can actually just do without the keywords: it's easy to figure out what is intended since class will never reach 100, and code will never go under 100. Will make this more intuitive to use since there's nothing to remember.

I've had great success using this sort of know-your-data "smart" search on company-internal databases for customers. People like it because it's intuitive and they don't need to remember keywords or mess with dropdowns.

Also, why don't you just call it http?

Completely agree. The pollution metaphor is apt: Not only the cognitive cost of looking over this code, realizing it’s displaying a CSV, and offering advice but also the real CO2 cost of hosting, packaging, distributing, running, and maintaining this code. Truly progressive devs should always consider these costs.
I would have used the Mozilla docs as a more official reference.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

You want to bring up pollution, what about the plethora of http status reference sites we already have. At least OP kept it to CLI. It’d be nice if it sourced it from Mozilla so it wouldn’t need updating.

The recommendation does not hold up when scrutinised.

MDN is also third-party, thus equally unofficial. The official sources are IANA and IETF.

The quality is objectively worse compared with webconcepts. It's not immediately visible where a status code originates from, and when you follow through to the detail document, you can see that the outdated RFC 2616 is referenced.

More official than hosted by some rando on GitHub pages with a .info domain.
The "rando" is a long term contributor to Web specifications.

The choice of top-level domain has zero significance, as I said previously, the only measure of official(?:ness|ity) is where the information originates from.

This comment is completely unnecessary and adds nothing to the discussion. How is the author publishing source code on his own github repo "burdening the public".
Your comment was egregiously hostile, and you're breaking the Show HN guidelines.

Currently, you're polluting the discussion for this submission by continuing to post in the subthread of an already-flagged comment.

Please stop.

The CLI ways I already have installed:

    man HTTP::Status            # courtesy of Perl and HTTP::Status
    pydoc requests.status_codes # because Python and requests
I refer to HTTP Status codes all the time throughout the day and use Python's built-in http library:

  >>> from http import HTTPStatus
  >>> HTTPStatus.OK
  <HTTPStatus.OK: 200>
  >>> HTTPStatus(404)
  <HTTPStatus.NOT_FOUND: 404>
Nice.

.bashrc:

httpcode () { python3 -c "from http import HTTPStatus; print(HTTPStatus($1))" }

Or even:

HTTPStatus($1).name.title().replace('_',' ')

I took a slightly different approach to this problem.

I made a CLI tool (bash) that leverages imgcat (the one that comes with iTerm2) to display images (in my terminal) from http.cat that correspond to the code I'm wondering about as well as a link to the mozilla docs with more details if i need them.

seeing the cats injects a smile into the frustration around "what the heck is a 407?!"

https://github.com/masukomi/masuconfigs/blob/master/bin/http...

I guess you can make the usage bit simpler by getting rid of "code" and "class" keywords

Why not simply do this?

$ hssp 204

$ hssp 2 -- lists everything under it

I've always used this one:

https://www.httpstatuses.org/

P.S. For some reason I can't remember if 301 or 302 is the permanent one.

P.P.S. I hate the fact that 401 should be Unauthenticated (instead of Unauthorized), and 403 should be Unauthorized (instead of Forbidden).

(comment deleted)
Nice work gathering all HTTP codes, but wouldn't this be simpler?

  lynx -dump https://developer.mozilla.org/en-US/docs/Web/HTTP/Status > HTTP-status-codes.txt
  grep 204 HTTP-status-codes.txt 
  grep 307 HTTP-status-codes.txt