📚 Improved backend codebase structure & documentation (#123) 🌟
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user