This commit is contained in:
Rizky 2024-06-21 13:54:40 +07:00
parent ee36f0d718
commit b2c5753ff3
1 changed files with 11 additions and 4 deletions

View File

@ -37,15 +37,22 @@ export const _ = {
});
res_body = await res.arrayBuffer();
console.log(
url,
res_headers["content-encoding"],
new TextDecoder().decode(res_body)
);
if (res_headers["content-encoding"] === "gzip") {
delete res_headers["content-encoding"];
} else if (res_headers["content-encoding"] === "br") {
res_body = brotli.decompress(res_body);
delete res_headers["content-encoding"];
}
// else if (res_headers["content-encoding"] === "zstd") {
// res_body = await decompress(res_body);
// delete res_headers["content-encoding"];
// } else if (res_headers["content-encoding"] === "br") {
// res_body = brotli.decompress(res_body);
// delete res_headers["content-encoding"];
// }
return new Response(res_body, { headers: res_headers });