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

isekai-main
Julian Lam 2 years ago
parent bcc4b82cc6
commit 007d735f92

@ -65,7 +65,8 @@ async function xhr(options, cb) {
const res = await fetch(url, options); const res = await fetch(url, options);
const { headers } = res; 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; let response;
if (isJSON) { if (isJSON) {

Loading…
Cancel
Save