Re:Ask HN: Happy 404 Day. Whats your favorite 404 error page?
by shrewm on Thursday April 04, 2024 @01:04PM
(#39933068)
I had a similar debate with coworkers about returning 404 when a DB webhoook query found no rows. It added extra complexity to client code trying to figure out if it was a bad URL, bad query, or just no rows.
[ Parent
| on HN ]
Re:Ask HN: Happy 404 Day. Whats your favorite 404 error page?
by everfree on Thursday April 04, 2024 @01:36PM
(#39933525)
404 means the server cannot find the requested resource. In the case of a database, the "resource" is the database endpoint.
So, 404 would be used in case the database endpoint does not exist at the URL you tried to access it at. A query returning zero rows would be a "success" in HTTP terms.
Re:Ask HN: Happy 404 Day. Whats your favorite 404 error page?
by bruce343434 on Thursday April 04, 2024 @02:18PM
(#39934039)
Yep, for that 204 (OK, but no results) exists. But if you serve a browser a page with 204 in the header, it refuses to render anything since 204 mandates an empty body, so the browser doesn't even look at it.