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

This commit is contained in:
Julian Lam
2023-07-26 14:09:43 -04:00
parent bcc4b82cc6
commit 007d735f92

View File

@@ -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) {