This commit is contained in:
Rizky 2024-08-03 17:48:14 +07:00
parent e32241fbb7
commit fab8bb24b5
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@ export const _ = {
let is_msgpack = req.query_parameters["msgpack"]; let is_msgpack = req.query_parameters["msgpack"];
console.log(is_msgpack);
if (validate(site_id)) { if (validate(site_id)) {
const mode = is_msgpack ? "binary" : "string"; const mode = is_msgpack ? "binary" : "string";
const result = { const result = {
@ -83,7 +84,9 @@ export const _ = {
}, },
}; };
return await gzipAsync(encode(result)); return await gzipAsync(
mode === "binary" ? encode(result) : JSON.stringify(result)
);
} }
return new Response("NOT FOUND", { status: 403 }); return new Response("NOT FOUND", { status: 403 });
}, },