From 72ca2647a965c2df5acc9fcb2726600c663eb449 Mon Sep 17 00:00:00 2001 From: TZGyn Date: Tue, 11 Feb 2025 21:22:42 +0800 Subject: [PATCH] log body in webhook --- src/routes/webhook/tradingview/+server.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/webhook/tradingview/+server.ts b/src/routes/webhook/tradingview/+server.ts index 232a08e..f148bb9 100644 --- a/src/routes/webhook/tradingview/+server.ts +++ b/src/routes/webhook/tradingview/+server.ts @@ -4,11 +4,15 @@ import { z } from 'zod' export const POST = async ({ locals, request }) => { const type = request.headers.get('Content-Type') - console.log(type) - if (type !== 'application/json') return new Response() + console.log('Type:', type) + if (type !== 'application/json; charset=utf-8') { + return new Response() + } const body = await request.json() + console.log('Body:', body) + const flatSchema = z.object({ type: z.literal('Flat'), key: z.string(),