Handle case-insensitive payload keys

This commit is contained in:
“Naeel” 2026-02-23 17:50:14 +04:00
parent 84583abb8c
commit e9b171b8df

View File

@ -61,11 +61,15 @@ function parseMessage(buffer) {
const body = buffer.toString("utf8");
try {
const parsed = JSON.parse(body);
const normalized = Object.keys(parsed || {}).reduce((acc, key) => {
acc[key.toLowerCase()] = parsed[key];
return acc;
}, {});
return {
action: parsed.action || "create",
id: parsed.id,
text: parsed.text,
requestId: parsed.request_id,
action: normalized.action || "create",
id: normalized.id,
text: normalized.text,
requestId: normalized.request_id || normalized.requestid,
};
} catch {
return {