You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
670 B
24 lines
670 B
import { httpProxy } from "utils/proxy/http";
|
|
|
|
export default async function handler(req, res) {
|
|
const { url } = req.query;
|
|
|
|
if (!url) {
|
|
return res.status(400).json({ error: "Missing Glances URL" });
|
|
}
|
|
|
|
const apiUrl = `${url}/api/3/quicklook`;
|
|
const params = { method: "GET", headers: {
|
|
"Accept-Encoding": "application/json"
|
|
} };
|
|
|
|
const [status, contentType, data, responseHeaders] = await httpProxy(apiUrl, params);
|
|
|
|
if (status !== 200) {
|
|
logger.error("HTTP %d getting data from glances API %s. Data: %s", status, apiUrl, data);
|
|
}
|
|
|
|
if (contentType) res.setHeader("Content-Type", contentType);
|
|
return res.status(status).send(data);
|
|
}
|