handle 204 and 304 proxy responses

This commit is contained in:
Ben Phelps 2022-09-11 14:30:14 +03:00
parent 236450f6f1
commit bc2025b3ba
2 changed files with 9 additions and 0 deletions

View file

@ -19,6 +19,10 @@ export default async function credentialedProxyHandler(req, res) {
},
});
if (status === 204 || status === 304) {
return res.status(status).end();
}
if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data);
}

View file

@ -13,6 +13,11 @@ export default async function genericProxyHandler(req, res) {
const [status, contentType, data] = await httpProxy(url);
if (contentType) res.setHeader("Content-Type", contentType);
if (status === 204 || status === 304) {
return res.status(status).end();
}
return res.status(status).send(data);
}
}