Skip to content

Commit c3c798d

Browse files
committed
🐛 fix: fix edge error
1 parent e0994fa commit c3c798d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

api/v1/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import fetchContent from './_utils';
2-
3-
export const config = {
4-
runtime: 'edge',
5-
};
1+
import type { VercelRequest, VercelResponse } from '@vercel/node';
62

7-
export default async (req: Request) => {
8-
if (req.method !== 'POST') return new Response('Method Not Allowed', { status: 405 });
3+
import fetchContent from './_utils';
94

10-
const args = (await req.json()) as { url: string };
5+
export default async function handler(req: VercelRequest, res: VercelResponse) {
6+
if (req.method !== 'POST') {
7+
res.status(405);
8+
}
119

12-
const result = await fetchContent(args);
10+
const result = await fetchContent(req.body);
1311

14-
return new Response(JSON.stringify(result));
15-
};
12+
res.send(result);
13+
}

0 commit comments

Comments
 (0)