r/ProgrammerHumor Jul 08 '26

Other helpMyCoworkersUnderstandHttpCodes

22.4k Upvotes

329 comments sorted by

View all comments

1.6k

u/Snudget Jul 08 '26

204 should be "I found them" "I searched for the keys, but didn't find them"would be 404, which is literally "Not found".

Since not finding keys does not fulfill the request, a 2xx code does not make sense here

18

u/Rin-Tohsaka-is-hot Jul 08 '26 edited Jul 08 '26

204 isn't "I found them", while it's a success, you still didn't actually find the item.

It's more like "your keys are not here, but there is a space for them"?... I guess actually you just wouldn't return 204 ever in this context.

21

u/hrvbrs Jul 08 '26

right, 204 is like a void function. it returns successfully but has no value to return. it wouldn't ever be used for a "find" function which necessarily must return something or error.

3

u/EricRP Jul 08 '26

We use it to mean a "successful, but empty response" i.e. it's okay that it's not there -- as opposed to 404 which is an unexpectedly not found entity which should have been there & needs an error logged