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 {getLLMText} from '@/lib/get-llm-text';
|
||||||
import {source} from '@/lib/source';
|
import {source} from '@/lib/source';
|
||||||
import {notFound} from 'next/navigation';
|
|
||||||
|
|
||||||
export const revalidate = false;
|
export const revalidate = false;
|
||||||
|
|
||||||
export async function GET(_req: Request, props: {params: Promise<{slug?: string[]}>}) {
|
export async function GET(_req: Request, props: {params: Promise<{slug?: string[]}>}) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
const page = source.getPage(params.slug);
|
const page = source.getPage(params.slug);
|
||||||
if (!page) notFound();
|
if (!page) return new Response('Not found', {status: 404});
|
||||||
|
|
||||||
return new Response(await getLLMText(page), {
|
return new Response(await getLLMText(page), {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user