fix: check response status in content script fetches

This commit is contained in:
2026-08-18 15:50:19 +08:00
parent c4f379ff1c
commit d12a7da646
+2
View File
@@ -77,6 +77,7 @@
body: body.toString(),
credentials: 'same-origin'
});
if (!resp.ok) throw new Error('Offered courses request failed: ' + resp.status);
const html = await resp.text();
const courses = ISMIStools.parseOfferedCourses(html);
const match = courses.find((c) => c.courseCode === courseCode);
@@ -115,6 +116,7 @@
let header = {};
try {
const resp = await fetch('/Manage/Student', { credentials: 'same-origin' });
if (!resp.ok) throw new Error('Profile request failed: ' + resp.status);
const html = await resp.text();
header = ISMIStools.parseProfilePage(html);
} catch (e) {