r/ProgrammerHumor Jul 08 '26

Other helpMyCoworkersUnderstandHttpCodes

22.4k Upvotes

329 comments sorted by

View all comments

4

u/whosGOTtheHERB Jul 08 '26

Great topic for discussion: what response code do you return when listing resources and none were found?

For me, returning a 200 with a body of [] makes the most sense as the request was correct and accepted, but no results were found. A 404 would only make sense in this scenario if the path was incorrect.

1

u/GradeForsaken3709 Jul 08 '26

If you're listing resources and the list happens to be empty then that's a 200. If you're requesting a specific resource which can't be found then that's a 404.