fix: update not found handling in GET route to return 404 response
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import {getLLMText} from '@/lib/get-llm-text';
|
||||
import {source} from '@/lib/source';
|
||||
import {notFound} from 'next/navigation';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(_req: Request, props: {params: Promise<{slug?: string[]}>}) {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound();
|
||||
if (!page) return new Response('Not found', {status: 404});
|
||||
|
||||
return new Response(await getLLMText(page), {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user