fix(moderation): improve error handling for malformed JSON responses and ensure proper response headers

This commit is contained in:
MythEclipse
2026-05-21 04:00:36 +07:00
parent 8884e29ce7
commit f851ea0fa9
2 changed files with 13 additions and 4 deletions
@@ -540,6 +540,8 @@ describe("runModerationAnalysis", () => {
global.fetch = vi.fn().mockResolvedValue({
ok: true,
status: 200,
headers: new Headers({ "Content-Type": "application/json" }),
text: async () => `${JSON.stringify(mockResponse)}\nextra`,
});