9168ca53da
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
488 B
TypeScript
23 lines
488 B
TypeScript
import { Handlers } from "$fresh/server.ts";
|
|
|
|
export const handler: Handlers = {
|
|
async POST(request, context) {
|
|
if (request.headers.get("content-type") != "application/json") {
|
|
return new Response(null, {
|
|
status: 400,
|
|
});
|
|
}
|
|
|
|
const responseBody = {
|
|
requestBody: await request.json(),
|
|
context,
|
|
};
|
|
|
|
return new Response(JSON.stringify(responseBody), {
|
|
headers: {
|
|
"content-type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
};
|