Skip to content

Node.js based forum software built for the modern web

fix: bug where api module would throw if response contained no content-type header

Julian Lam007d735f927e
diff --git a/public/src/modules/api.js b/public/src/modules/api.js
index 0993a8de66..bfda975662 100644
--- a/public/src/modules/api.js
+++ b/public/src/modules/api.js
@@ -65,7 +65,8 @@ async function xhr(options, cb) {
const res = await fetch(url, options);
const { headers } = res;
- const isJSON = headers.get('content-type').startsWith('application/json');
+ const contentType = headers.get('content-type');
+ const isJSON = contentType && contentType.startsWith('application/json');
let response;
if (isJSON) {