📚 Improved backend codebase structure & documentation (#123) 🌟

This commit is contained in:
Till Tomczak
2025-06-20 12:26:29 +02:00
parent 286a70b01f
commit 59f5c543e3
24 changed files with 757 additions and 8 deletions

View File

@ -226,6 +226,16 @@ window.refreshJobs = async function() {
throw new Error(`API-Fehler: ${response.status} ${response.statusText}`);
}
// Content-Type-Validation
const contentType = response.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) {
const text = await response.text();
if (text.includes('<!DOCTYPE html>') || text.includes('<html')) {
throw new Error(`Server-Fehlerseite erhalten statt JSON-Response`);
}
throw new Error(`Unexpected content-type: ${contentType}`);
}
const data = await response.json();
console.log('📝 API-Response erhalten:', data);