mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: bug where api module would throw if response contained no content-type header
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user