This commit is contained in:
Francisco Coelho 2022-09-11 22:08:11 +01:00
commit a304d87b8a
32 changed files with 597 additions and 203 deletions

View file

@ -18,11 +18,16 @@ export default async function credentialedProxyHandler(req, res) {
if (widget) {
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
const [status, contentType, data] = await httpProxy(url, {
method: req.method,
withCredentials: true,
credentials: "include",
headers: headersData,
});
if (status === 204 || status === 304) {
return res.status(status).end();
}
if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data);
}