x
This commit is contained in:
1 parent
32e9fd5ac6
commit
658a08f8dc
1 file changed
+3
-3
@@ -10,8 +10,8 @@ const webhookHandler = async ({ request, body, set }: { request: Request, body:
|
|||||||
set.status = 400;
|
set.status = 400;
|
||||||
return { error: 'Missing Signature' };
|
return { error: 'Missing Signature' };
|
||||||
}
|
}
|
||||||
|
|
||||||
// In our global onParse hook, we intercepted the body and returned it as a raw text string.
|
// xxIn our global onParse hook, we intercepted the body and returned it as a raw text string.
|
||||||
const rawBody = typeof body === 'string' ? body : JSON.stringify(body);
|
const rawBody = typeof body === 'string' ? body : JSON.stringify(body);
|
||||||
|
|
||||||
if (!rawBody) {
|
if (!rawBody) {
|
||||||
@@ -35,7 +35,7 @@ const webhookHandler = async ({ request, body, set }: { request: Request, body:
|
|||||||
try {
|
try {
|
||||||
const parsedBody = typeof body === 'string' ? JSON.parse(body) : body;
|
const parsedBody = typeof body === 'string' ? JSON.parse(body) : body;
|
||||||
const events: line.WebhookEvent[] = parsedBody.events || [];
|
const events: line.WebhookEvent[] = parsedBody.events || [];
|
||||||
|
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
if (event.type === 'message' && event.message.type === 'text') {
|
if (event.type === 'message' && event.message.type === 'text') {
|
||||||
// Ignore verification dummy tokens
|
// Ignore verification dummy tokens
|
||||||
|
|||||||
Reference in new issue
Block a user