check that content type exists before setting it

This commit is contained in:
Ben Phelps 2022-09-05 10:08:02 +03:00
parent bad436b858
commit 08afa0b747
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ export default async function credentialedProxyHandler(req, res) {
}, },
}); });
res.setHeader("Content-Type", contentType); if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data); return res.status(status).send(data);
} }
} }

View File

@ -12,7 +12,7 @@ export default async function genericProxyHandler(req, res) {
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
const [status, contentType, data] = await httpProxy(url); const [status, contentType, data] = await httpProxy(url);
res.setHeader("Content-Type", contentType); if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data); return res.status(status).send(data);
} }
} }