4 ms·
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
by shrewm 3y ago
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.
- everfree 3y ago404 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.
- bruce343434 3y agoYep, 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.