fix: handle empty response body in HTTP client

This commit is contained in:
Sam Chau
2026-01-15 15:20:02 +10:30
parent f35a01f111
commit cabf1ff815

View File

@@ -75,8 +75,9 @@ export class BaseHttpClient {
clearTimeout(timeoutId);
// Parse response
const data = await response.json();
// Parse response - handle empty body (common for DELETE)
const text = await response.text();
const data = text ? JSON.parse(text) : null;
// Check for HTTP errors
if (!response.ok) {