update: lower message length limit

This commit is contained in:
Tony Yang
2025-04-15 10:40:53 +08:00
parent ba0bc1a243
commit b07c056ee5
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -28,10 +28,11 @@ export async function onRequestPost(context) {
const { message } = await request.json();
if (!message) {
return new Response(JSON.stringify({"error": "Missing message"}), {
status: 400,
headers: { 'Content-Type': 'application/json' },
});
return createErrorResponse("Empty message", 400);
}
if (message.length > 200) {
return createErrorResponse("Message too long", 400);
}
// Generate a unique ID for the message