mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix: read raw request + body via h3 context for discord/telegram webhooks
This commit is contained in:
3 files changed
+47
-8
No files matched your search
@@ -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));
|
||||
});
|
||||
Reference in new issue
Block a user