mirror of https://github.com/lissy93/dashy
🔒 Updates CORS proxy to use res.status
This commit is contained in:
parent
58a085a550
commit
6cd9eac49b
|
@ -23,7 +23,7 @@ module.exports = (req, res) => {
|
||||||
// Get desired URL, from Target-URL header
|
// Get desired URL, from Target-URL header
|
||||||
const targetURL = req.header('Target-URL');
|
const targetURL = req.header('Target-URL');
|
||||||
if (!targetURL) {
|
if (!targetURL) {
|
||||||
res.send(500, { error: 'There is no Target-Endpoint header in the request' });
|
res.status(500).send({ error: 'There is no Target-Endpoint header in the request' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Apply any custom headers, if needed
|
// Apply any custom headers, if needed
|
||||||
|
@ -40,8 +40,8 @@ module.exports = (req, res) => {
|
||||||
// Make the request, and respond with result
|
// Make the request, and respond with result
|
||||||
axios.request(requestConfig)
|
axios.request(requestConfig)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
res.send(200, response.data);
|
res.status(200).send(response.data);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
res.send(500, { error });
|
res.status(500).send({ error });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue