From 007d735f927eba6cc33d84715b0d4b584626ccde Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 26 Jul 2023 14:09:43 -0400 Subject: [PATCH] fix: bug where api module would throw if response contained no content-type header --- public/src/modules/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) {