fix: correct empty-result and maxItems handling in routes
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user