News for hackers. Stuff that matters.
Re:I’ve banned query strings by rswail on Sunday May 10, 2026 @05:07AM (#48082259)

    204 No Content
for nothing found is both not an error (because 2xx code) but also indicates there was nothing found to match the request.

If it's an API, a 200 with an empty JSON object or array in the body is legitimate as well, but a 204 is explicit.

Re:I’ve banned query strings by tacitusarc on Sunday May 10, 2026 @10:34AM (#48084326)
This too is not spec compliant. 204 means the request was successful but no body is being returned in the response.
Re:I’ve banned query strings by rswail on Monday May 11, 2026 @02:13AM (#48091569)
Which is the equivalent of nothing found matching the request in a collection.

The alternate is basically 200 OK

followed by a JSON body of:

[]

Re:I’ve banned query strings by greybeard69 on Monday May 11, 2026 @06:59AM (#48093404)
My rule of thumb is that if you want to keep your code clean, always returning an empty collection is preferable to returning an empty response on that branch. You don't need a guard clause to null/undef-check before consuming the result. The rule applies whether we're consuming the response from a repository or an http request.