decompress brotli

This commit is contained in:
Rizky 2024-06-20 11:57:50 +07:00
parent 14120c8465
commit 244bd86691
1 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,7 @@ export const _ = {
headers[k] = v;
});
const res = await fetch(url, {
const res = await fetch(url as any, {
method: req.method || "POST",
headers,
body,
@ -38,6 +38,8 @@ export const _ = {
res_body = await res.arrayBuffer();
if (res_headers["content-encoding"] === "gzip") {
res_body = await gzipAsync(new Uint8Array(res_body));
} if (res_headers["content-encoding"] === "br") {
res_body = brotli.decompress(new Uint8Array(res_body));
} else {
delete res_headers["content-encoding"];
}