diff --git a/src/mocks/handlers/posthog.js b/src/mocks/handlers/posthog.js index 196fae4e..ded90097 100644 --- a/src/mocks/handlers/posthog.js +++ b/src/mocks/handlers/posthog.js @@ -82,4 +82,30 @@ export const posthogHandlers = [ ); } }), + + // PostHog session recording 接口(会话录制) + http.post('https://us.i.posthog.com/s/', async ({ request }) => { + try { + const body = await request.text(); + + if (process.env.NODE_ENV === 'development' && process.env.REACT_APP_LOG_POSTHOG === 'true') { + console.log('[Mock] PostHog session recording 请求:', { + url: request.url, + bodyPreview: body.substring(0, 100) + (body.length > 100 ? '...' : ''), + }); + } + + // 返回成功响应 + return HttpResponse.json( + { status: 1 }, + { status: 200 } + ); + } catch (error) { + console.error('[Mock] PostHog session recording handler error:', error); + return HttpResponse.json( + { status: 0, error: 'Mock handler error' }, + { status: 500 } + ); + } + }), ];