feat: 客服接口mock添加
This commit is contained in:
22
src/mocks/handlers/bytedesk.js
Normal file
22
src/mocks/handlers/bytedesk.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// src/mocks/handlers/bytedesk.js
|
||||||
|
/**
|
||||||
|
* Bytedesk 客服 Widget MSW Handler
|
||||||
|
* 使用 passthrough 让请求通过到真实服务器,消除 MSW 警告
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { http, passthrough } from 'msw';
|
||||||
|
|
||||||
|
export const bytedeskHandlers = [
|
||||||
|
// Bytedesk API 请求 - 直接 passthrough
|
||||||
|
// 匹配 /bytedesk/* 路径(通过代理访问后端)
|
||||||
|
http.all('/bytedesk/*', () => {
|
||||||
|
return passthrough();
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Bytedesk 外部 CDN/服务请求
|
||||||
|
http.all('https://www.weiyuai.cn/*', () => {
|
||||||
|
return passthrough();
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
export default bytedeskHandlers;
|
||||||
@@ -16,6 +16,7 @@ import { limitAnalyseHandlers } from './limitAnalyse';
|
|||||||
import { posthogHandlers } from './posthog';
|
import { posthogHandlers } from './posthog';
|
||||||
import { externalHandlers } from './external';
|
import { externalHandlers } from './external';
|
||||||
import { agentHandlers } from './agent';
|
import { agentHandlers } from './agent';
|
||||||
|
import { bytedeskHandlers } from './bytedesk';
|
||||||
|
|
||||||
// 可以在这里添加更多的 handlers
|
// 可以在这里添加更多的 handlers
|
||||||
// import { userHandlers } from './user';
|
// import { userHandlers } from './user';
|
||||||
@@ -36,5 +37,6 @@ export const handlers = [
|
|||||||
...posthogHandlers,
|
...posthogHandlers,
|
||||||
...externalHandlers,
|
...externalHandlers,
|
||||||
...agentHandlers,
|
...agentHandlers,
|
||||||
|
...bytedeskHandlers, // ⚡ Bytedesk 客服 Widget passthrough
|
||||||
// ...userHandlers,
|
// ...userHandlers,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user