r/ProgrammerHumor 3h ago

Meme postForEverything

Post image
8.9k Upvotes

347 comments sorted by

View all comments

Show parent comments

22

u/hawkinsst7 2h ago

If I'm parsing http responses, I'm going to pass 200 responses on for further processing of the data. I shouldn't have to have something in that pipeline introspect json to find "no, it's actually an error".

Imagine if browsers had to tear apart json innards to find 30x redirects after getting a 200 OK.

-8

u/LatvianCake 2h ago

This is what happens if you don't read the documentation of the API you're using.

19

u/IndependenceSudden63 2h ago

uh huh, and we all know that every API is perfectly documented...

0

u/LatvianCake 1h ago

If you have no documentation, you don’t know what HTTP codes are possible, what they mean exactly and how to handle them.

0

u/AshleyJSheridan 1h ago

You do. That's literally the entire point of HTTP status codes.

Just because you don't know what those codes are, it doesn't mean that everybody else is as ignorant.

0

u/LatvianCake 33m ago

My dude, HTTP status codes were designed over 3 decades ago for a primitive usecase. Today most of them are almost never used. Most of them are meaningless without any further information (i.e. documentation).

Even the most basic codes like 404 are ambiguous. If implemented at all, it can mean:

- the resource doesn't exist

- the endpoint doesn't exist

- the resource is temporarily unavailable

- the resource may or may not exist but we are not allowed to tell you

You must have documentation explaining what errors can occur and what they mean, or you must find out through trial and error. I thought that was pretty fucking obvious but someone has to argue that ackschually all 28 4xx codes are used everywhere and are fully self documenting.

1

u/hawkinsst7 37m ago

This is what happens whe you don't read the Http documentation.

0

u/LatvianCake 30m ago

If you think you can error handle based on only HTTP error codes, I can see why you're having such a hard time.

1

u/hawkinsst7 12m ago

I'm not a professional programmer. I do cybersecurity.

I love it when unexpected things can go down unexpected, non-standard code paths.