fix: correct empty-result and maxItems handling in routes

This commit is contained in:
2026-04-27 09:34:08 -04:00
parent 974190de6b
commit a802035ca4
4 changed files with 164 additions and 23 deletions

View File

@@ -63,7 +63,12 @@ export async function kijijiRoute(req: Request): Promise<Response> {
searchOptions,
{},
);
if (!items)
const isEmpty = hideUnstableResults
? items.results.length === 0 && items.unstableResults.length === 0
: !items || items.length === 0;
if (isEmpty)
return Response.json(
{ message: "Search didn't return any results!" },
{ status: 404 },