mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
fix: read raw request + body via h3 context for discord/telegram webhooks
This commit is contained in:
parent
b139712a91
commit
2106aad3b8
3 changed files with 47 additions and 8 deletions
|
|
@ -1,6 +1,14 @@
|
|||
import { readRawBody } from "h3";
|
||||
import { handleTelegramWebhookRequest } from "../../lib/drivers/telegram/updates";
|
||||
import { cfEnv } from "../../lib/cf";
|
||||
import { cfEnv, rawRequest } from "../../lib/cf";
|
||||
|
||||
export default defineEventHandler((event) =>
|
||||
handleTelegramWebhookRequest(event.web!.request!, cfEnv(event)),
|
||||
);
|
||||
export default defineEventHandler(async (event) => {
|
||||
const source = rawRequest(event);
|
||||
const body = await readRawBody(event, "utf8");
|
||||
const request = new Request(source.url, {
|
||||
method: source.method,
|
||||
headers: source.headers,
|
||||
body,
|
||||
});
|
||||
return handleTelegramWebhookRequest(request, cfEnv(event));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue