diff --git a/backend/src/services/AqlExecutor.ts b/backend/src/services/AqlExecutor.ts index ac50868..03d8acf 100644 --- a/backend/src/services/AqlExecutor.ts +++ b/backend/src/services/AqlExecutor.ts @@ -159,6 +159,18 @@ export class AqlExecutor { throw new Error(`AQL API error (${response.status}): ${errorText}`); } + // Обрабатываем пустой ответ (204 No Content) + if (response.status === 204) { + console.log('\n=== AQL Response ==='); + console.log('Status: 204 (No Content)'); + console.log('====================\n'); + return { + rows: [], + rowCount: 0, + executionTime, + }; + } + // Парсим JSON ответ const responseText = await response.text(); console.log('\n=== AQL Response ==='); @@ -166,6 +178,15 @@ export class AqlExecutor { console.log('Raw Response:', responseText); console.log('====================\n'); + // Если ответ пустой, возвращаем пустой результат + if (!responseText || responseText.trim() === '') { + return { + rows: [], + rowCount: 0, + executionTime, + }; + } + let data; try { data = JSON.parse(responseText);